Docker – exec: "bash": executable file not found in $PATH

If bash shell is not working, try sh.

Terminal

$ docker ps

CONTAINER ID        IMAGE               COMMAND               CREATED             STATUS              PORTS                  NAMES
3d1588519433        markdownhtml:0.1    "java -jar app.jar"   About an hour ago   Up About an hour    0.0.0.0:80->8080/tcp   gracious_haibt

$ docker exec -it 3d1588519433 bash

OCI runtime exec failed: exec failed: container_linux.go:349:
starting container process caused "exec: \"bash\": executable file not found in $PATH": unknown

The truth is, not every image is using the bash shell; try sh shell.

Terminal

$ docker exec -it 3d1588519433 sh

/home/hello #

References

author image

mkyong

Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities. Read all published posts by

Comments

avatar