Unable to run image due to standard_init_linux.go error
Expected Behavior
When running an image created with docker-slim, it should actually run the image and not output an error.
Actual Behavior
When trying to run the image created with docker-slim:
standard_init_linux.go:219: exec user process caused: no such file or directory
Searching for this error, the usual case for its appearance seems to be that the entrypoint script cannot be found.
However, I checked the actual files inside the image and the bash script is definitely there (and so is bash itself).
I'm not sure what other file that error could refer to...
The same Dockerfile creates a runnable image via "normal" docker just fine.
Steps to Reproduce the Problem
Can't really help here much since the project is not open source. However, this is the ENTRYPOINT line of the Dockerfile:
ENTRYPOINT ["/usr/local/bin/setup_sshd"]
And the build command is the following:
sudo docker-slim build --http-probe=false --dockerfile containers/base/Dockerfile --tag lalalala.dkr.ecr.us-east-2.amazonaws.com/base:slimtest --mount /var/run/docker.sock:/var/run/docker.sock --mount /usr/bin/docker:/usr/bin/docker --exec-file "util/dockerslim_execfile" --include-path-file "util/dockerslim_includefile"--continue-after=5 --include-exe-file util/dockerslim_includefile --include-shell=true .
dockerslim_includefile includes only /usr/local/bin/setup_sshd as that file would otherwise get removed by docker-slim (ps: I don't think docker-slim should ever remove an entrypoint file).
Specifications
- Version: docker-slim version linux|Transformer|1.34.0-16-gdc85082|dc85082121a8abf5c3984668b8a0c87d3fd7a51a|2021-02-16_07:58:23AM
- Platform: Manjaro Linux
@TheSHEEEP is it possible to share a bit more about your container image? Why are you mounting docker.sock and docker? What's in util/dockerslim_execfile? What are you doing with ssh there?
I'm mounting docker.sock and docker in order to use Docker-out-of-Docker (instead of Docker-in-Docker, due to the immense amount it saves on the image size and none of the downsides of DooD being relevant to us).
util/dockerslim_execfile just contains a few random commands / tests (the idea was to execute a bunch of vital files to make docker-slim think those files are being used so it won't delete them):
ls -al
stat /usr/local/bin/setup_sshd
docker-credential-ecr-login version
aws --version
java --version
docker container ls || true
docker images || true
mcedit -V
> testfile2
echo "test" >> testfile2
echo "All done!"
setup_sshd is just a script that opens an SSH server and listens for incoming connections. The purpose is to use it in conjunction with Jenkins, which will SSH into a container and start agents on it. It looks more or less like this one: https://github.com/jenkinsci/docker-ssh-agent/blob/master/setup-sshd