Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker build question no permission to read from

Tags:

docker

ubuntu

I'm trying to build a docker image

I get this error

sudo docker build . -t django-demo
error checking context: 'no permission to read from '/home/benny/.ICEauthority''

any ideas why this is happening?

--------------------------
ubuntu 18.04
Docker version 18.09.9
like image 755
林班尼 Avatar asked Feb 07 '20 17:02

林班尼


People also ask

How do I fix Docker permission denied?

Similar to running a docker command without the sudo command, a stopped Docker Engine triggers the permission denied error. How do you fix the error? By restarting your Docker engine. Run the systemctl command below to confirm the Docker Engine's status ( status docker ) and if it's running.

What happens when you press Ctrl P Q inside the container in Docker?

Run Hub docker container Note that pressing `Ctrl+C` when the terminal is attached to a container output causes the container to shut down. Use `Ctrl+PQ` in order to detach the terminal from container output.

Do you need Dockerfiles with Docker compose?

Both the Dockerfile and docker-compose are important resources in the development and deployment of cloud-native applications. But knowing the difference between docker-compose and the Dockerfile is important. The Dockerfile is used to build images, while docker-compose helps you run them as containers.


2 Answers

Create a new directory, place your Dockerfile in this new directory and then run your sudo docker build . -t django-demo command from that directory. This should solve your problem. Found related problems and solution in this external thread.

like image 143
AmitP Avatar answered Sep 22 '22 19:09

AmitP


Generally to solve this kind of problem you should add a .dockerignore file in which you list all the files you don't want to be sent to the build's context (ie. the files that docker don't need to build your image).

In your case simply creating a .dockerignore with the following content should solve the issue :

.ICEauthority

Note that specifically in your case though, you should not run your docker build command directly from your home directory, because all the content of your home is being sent to the build's context (which is heavy, might make you run out of disk space or generate permission issues).

like image 28
benterris Avatar answered Sep 19 '22 19:09

benterris