September 2018
Intermediate to advanced
764 pages
20h 6m
English
Our Dockerfile is now ready, and we can use it to generate the image using docker build, which has the following signature:
$ docker build [context] -f [path/to/Dockerfile]
The docker build command builds an image based on the Dockerfile and a context. The context is a directory which should contain all the files that are needed to build the image. In our case, it is also where our application code is to be copied from.
For example, if we are at the project root directory, we can run the following command to build our image, using the current working directory as the context:
$ docker build . -f ./Dockerfile
By default, if you don’t specify the location of the Dockerfile, Docker would try to find it at the root of the ...
Read now
Unlock full access