docker build failed on windows 10,
After docker installed successfully, While building docker image using below command.
docker build -t drtuts:latest . Facing below issue.
Kindly let me know if any one resolved same issue.
The docker build command builds Docker images from a Dockerfile and a “context”. A build's context is the set of files located in the specified PATH or URL . The build process can refer to any of the files in the context. For example, your build can use a COPY instruction to reference a file in the context.
¶ If your Docker image builds takes a long time downloading dependencies, it's a good idea to check whether you're installing more than you need to. First, check if you might be downloading development dependencies which are not needed in your image at all.
dockerignore file and exclude it from the Docker build context. In fact, it is a common practice than you might have thought. This allows you not to expose the entire blueprint of your Docker application.
The best way to work around this is to specify the Dockerfile independently of the build context, using -f. For instance, this command will give the ADD command access to anything in your current directory. docker build -f docker-files/Dockerfile .
The problem is that the current user is not the owner of the directory.
I got the same problem in Ubuntu, this line solves the issue:
Ubuntu
sudo chown -R $USER <path-to-folder>
Source: Change folder permissions and ownership
Windows
This link shows how to do the same in Windows:
Take Ownership of a File / Folder through Command Prompt in Windows 10
Just create a new directory and enter it:
$ mkdir dockerfiles $ cd dockerfiles
Create your file in that directory:
$ touch Dockerfile
Edit it and add the commands with vi
:
$ vi Dockerfile
Fnally run it:
$ docker build -t tag .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With