Hi, today I would like to share with you solution to a problem I've encountered when I tried to login to docker container.
[root@localhost]# docker exec -ti auth-service /bin/bash OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown
Solution is quite simple.
# Use /bin/sh instead of /bin/bash docker exec -t -i PUT_CONTAINER_NAME_HERE /bin/sh
The docker container didn't have
/bin/bash installed, so I used
/bin/sh instead and it solved my problem.
Example of correct login to docker container using /bin/sh:
$ docker exec -ti auth-service /bin/sh
Practical example from CMD:
[root@localhost]# docker exec -ti auth-service /bin/sh / # ls -al total 43548 drwxr-xr-x 1 root root 46 Oct 1 18:09 . drwxr-xr-x 1 root root 46 Oct 1 18:09 .. -rwxr-xr-x 1 root root 0 Oct 1 18:09 .dockerenv drwxr-xr-x 2 root root 4096 May 9 2019 bin
So to sum up the post, we can login to docker container:
# Using /bin/sh docker exec -t -i PUT_CONTAINER_NAME_HERE /bin/sh # Using /bin/bash # Second option when our linux doesn't have /bin/sh, we need to use another shell /bin/bash docker exec -t -i PUT_CONTAINER_NAME_HERE /bin/bash