Running any process from the console can cause an exec error. The first step to fixing this is to see if there is a problem with inputting the data, command or configurations.
What is causing this specific docker error?
Let us simulate this error message by running an alpine docker container:
[[email protected] ~]# docker run -it alpine /bin/bash
Unable to find image 'alpine:latest' locally
Trying to pull repository docker.io/library/alpine ...
latest: Pulling from docker.io/library/alpine
89d9c30c1d48: Pull complete
Digest: sha256:c19173c5ada610a5989151111163d28a67368362762534d8a8121ce95cf2bd5a
Status: Downloaded newer image for docker.io/alpine:latest
/usr/bin/docker-current: Error response from daemon:
oci runtime error: container_linux.go:235:
starting container process caused "exec: "/bin/bash":
stat /bin/bash: no such file or directory".
Reason for this error
Look at the last line. It says:
"exec: \"/bin/bash\": stat /bin/bash: no such file or directory".
The alpine image does not come with a bash shell. It has the sh shell.
Solution #1 install the package bash
Here is the detailed guide for installing bash.: How to install bash in docker alpine container
or simply, you can connect to the container and then run the apk add command:
apk add --no-cache bash

Solution #2 use the sh shell instead of Bash
Let us try opening the alpine container again by calling /bin/sh.
docker run -it alpine /bin/sh
And it works!
[[email protected] ~]# docker run -it alpine /bin/sh
/ #

I’ve seen many people asking about how to fix this error when trying to run the basic commands in a new docker container like this. Hope this guide helps you to check in the right direction.