When the Docker container is running, you may sometimes encounter various error reports, such as "no such file or directory", "permission denied", "connection refused", etc. These error reports often make us feel confused and don’t know how to solve them.
One of the common errors is that when we use the docker run
command to run a container, it will prompt "docker: Error response from daemon: OCI runtime create failed: container_linux.go :345: starting container process caused "exec:" error. So what does this error mean and how to solve it?
This error means that Docker cannot run the specified command when creating a container. Among them, "container_linux.go:345" means that there is a problem when Docker is actually running in a Linux container. "exec: permission denied" means that Docker cannot execute the specified command because the permission is denied.
So why does such an error occur? Generally speaking, there are two possible causes for this error.
First of all, it may be because you are trying to run a command without permission. In Docker containers, the permissions required to run commands are very limited. If you try to run a command that requires special permissions, then you will encounter permission denied issues.
Secondly, it may be because you are using the wrong Dockerfile or image. In Docker, each container depends on one or more images. If there is a problem with the image or Dockerfile you use, the container will not run properly.
Next, let’s take a look at how to solve this problem. The specific method is as follows:
--privileged
parameter when running the container. This parameter allows the container to obtain more permissions, which may solve the problem of permission denial. To sum up, when we use Docker container to run, we encounter "docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: permission denied" error, it may be because the command we use does not have permission, or there is a problem with the Dockerfile or image we use. If you are sure there are no problems with these two aspects, you can try adding --privileged
parameters to solve the problem.
The above is the detailed content of How to solve the error when docker runs the container. For more information, please follow other related articles on the PHP Chinese website!