Main Tutorials

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

About Author

author image
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.

Comments

Subscribe
Notify of
15 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Aleksb86
2 years ago

Thanks sir! In Alpine Linux there is another yet shell – ash))

Md Asaduzzaman Atik
2 years ago
Reply to  Aleksb86

Thanks Man!!!!!!!!!

dewesh pushkar
19 days ago

Thanks a lot 🙂

Ridealist
1 year ago

Thanks… You save my life 🙂

ambiorixg12
1 year ago

It works perfect

docker exec -it 147bf86f4612 sh

Luis Bragado
1 year ago

Thanks a lot my friend!

naseem
1 year ago

thank you

Vinso
1 year ago

Thank you.

Thaamaraiselvan
2 years ago

Perfect….

Hajar Razip
2 years ago

Geeeeeeeeeeeeeeeeeeez thanks man. Exactly what I needed. I’m so used to running a ubuntu image I forgot this time I’m running an alpine. *face slap*

Sergey
2 years ago

Very useful tip, thank you!

Shubham
2 years ago

Thank You

Anurag
3 years ago

Thank you!

Mostefa
3 years ago

Thnx!

FX Bayu Anggara
3 years ago

Wow, thank you very much!