I have created a couple different directories on my host machine as I try to learn about Docker just to keep my dockerfiles organized. My Dockerfile I just ran looks like t
I had the same issue as FreeStyler. However I was building from a directory one up from my context. So the -f arguments were correct the context was incorrect.
project
|
-------docker-dir
Building from the docker-dir the following was fine
docker build -t br_base:0.1 .
Building from the dock-dir the the build context changed. Therefore I needed to change the context in the command. Context is given by the '.' in the command above.
The the new command from the project directory should be
docker build -t br_base:0.1 ./base
Context here is given by the './base'
In my case that was when i execute with wrong -f arguments - without path to directory where located Dockerfile
docker build --no-cache -t nginx5 -f /home/DF/Dockerfile /home/DF/ - right
docker build --no-cache -t nginx5 -f /home/DF/Dockerfile - wrong
For NodeJS Application, add a .dockerignore file your root project directory and inside the .dockerignore file add the following
node_modules
dist
Just to summarize what you can do if your Docker image build context too large: