docker,

How to fix Docker: unable to start container process: exec: '/bin/bash'

Jul 26, 2022 · 1 min read · 112 views · Post a comment

If you get this kind of error: docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/bin/bash": stat /bin/bash: no such file or directory: unknown. or ERRO[0000] error waiting for container: context canceled that means that your Docker image doesn’t have a bash environment, and you can’t use the /bin/bash executable.

Prerequisites

  • Docker

Solution

Step 1. One solution is to replace and run the bash environment with shell.

sudo docker run -it IMAGE-ID /bin/sh

or, if the container is running already:

sudo docker exec -it CONTAINER-ID /bin/sh

Step 2. If you are using Alpine Linux as a Docker image you can install bash within the Dockerfile.

RUN apk add --no-cache bash

Conclusion

Let me know if you need any additional help. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.