/bin/bash gives me the error inside docker container

i have been trying to cope with sh, but there have been multiple problems being arose. I need /bin/bash inside Docker Container. But when i run this command it gives me the error 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. i think i need to get bin/bash inside the container. But dont know how?

Terminal Command: sudo docker exec -it 35f4fb7c0b0d /bin/bash

Terminal Output: 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

Thanks in Advance.

Upvotes: 3

Views: 9844

Answers (2)

Thakur Amit
Thakur Amit

Reputation: 447

If your image is using an alpine version then it comes pre-loaded with the "sh" which is "light weight Bourne shell" similar to "bash", you don't need to install the bash again you can simply use the "sh" instead of "bash".

sudo docker exec -it 35f4fb7c0b0d sh

Upvotes: 12

I have solved the problem. The problem was bash was not present in there in container. So i need to install it by specifying it in the Dockerfile. It then be available in container.

RUN apk update && apk add bash

Thanks Lawrence Cherone

Upvotes: 0

Related Questions