Docker run permission denied – How we sort it out?
Are you getting permission denied error when you run the Docker image? We can help you in fixing it.
We often fix this error by identifying the file which lacks permissions.
Thereafter we check them and make it executable so that the error doesn’t come up again.
At Bobcares, we often get requests to fix Docker errors, as a part of our Docker Hosting Support.
Today, we’ll see how our Support Engineers fix this Docker error.
Explore more about Docker
Docker is a container engine. Containers allow a developer to wrap up an application with all its dependencies into one package.
Docker helps in creating, deploying and running containers on top of the operating system. Docker runs the image by reading a Dockerfile.
Why does Docker show permission denied error?
Customers often get errors while running a Docker image. And this is usually caused due to improper setup.
One such error is permission denied while running a Docker image. It can be due to different files in different cases.
When we run a docker run command, it relays on many files to load the Docker image. When these files do not have enough permissions then it shows up permission denied error.
Let’s see a few instances when our Support Engineers fixed this error.
How we fix the Docker run permission denied error?
Whenever a customer approaches us with this error, our Support Engineers check the Docker files.
Recently one of our customers got the error message as
docker: Error response from daemon: oci runtime error: exec: “/node/execute.sh”: permission denied.
Here the error is with executing.sh file. So we check if it has the shebang line at the top.
Later, we added it and made this file executable. For this, we add the following line in the Dockerfile,
RUN [“chmod”, “+x”, "/node/execute.sh”]
Finally, rebuilding and running the image fixed the error.
Similarly, another error was with entrypoint.sh for another customer. Here the complete error message appeared as
docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"https://cdn.bobcares.com/entrypoint.sh\": permission denied".
To fix this we corrected the permission of this bash file. And change the code as,
Afterward, we always rebuild the image and run the container.
[Need help in fixing Docker errors? – We can help you to fix it.]
So far, we saw the reasons for the Docker run permission denied error. We also saw how our Support Engineers fix this error by making Docker files executable.