Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting permission denied in docker run

Tags:

docker

I am trying using Docker using Dockerfile.

My Dockerfile as follows, where I am using debian linux system.

FROM debian:jessie  ENV DEBIAN_FRONTEND noninteractive  ARG AIRFLOW_VERSION=1.7.1.3 ENV AIRFLOW_HOME /usr/local/airflow  .. ..  COPY script/entrypoint.sh /entrypoint.sh COPY config/airflow.cfg ${AIRFLOW_HOME}/airflow.cfg .. ..     USER airflow WORKDIR ${AIRFLOW_HOME} ENTRYPOINT ["/entrypoint.sh"] 

So when I run docker build -t test ., it build without problem.

However, when I run docker run -p 8080:8080 test.

It throws following error:

container_linux.go:247: starting container process caused "exec: \"/entrypoint.sh\": permission denied" docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"/entrypoint.sh\": permission denied". 

What is I am doing wrong ?

like image 843
Kush Patel Avatar asked Jun 21 '17 23:06

Kush Patel


People also ask

How do I fix Docker got permission denied while trying to connect to the Docker daemon socket?

Fix 1: Run all the docker commands with sudo If you have sudo access on your system, you may run each docker command with sudo and you won't see this 'Got permission denied while trying to connect to the Docker daemon socket' anymore.

Does not have permissions to run Docker commands?

The error message tells you that your current user can't access the docker engine, because you're lacking permissions to access the unix socket to communicate with the engine. As a temporary solution, you can use sudo to run the failed command as root (e.g. sudo docker ps ).

How much RAM should I allocate to Docker?

Limit a container's access to memory The maximum amount of memory the container can use. If you set this option, the minimum allowed value is 6m (6 megabytes). That is, you must set the value to at least 6 megabytes. The amount of memory this container is allowed to swap to disk.


1 Answers

You need to change the permission of the bash file by chmod +x entrypoint.sh before calling ENTRYPOINT. So change your code to the following:

USER airflow WORKDIR ${AIRFLOW_HOME} RUN chmod +x entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] 

Rebuild the image and run the container, it should work.

like image 82
TheCyberliem Avatar answered Sep 23 '22 03:09

TheCyberliem