Using Dockerfiles

Now that we understand what every other Dockerfile instruction does, we can prepare our first Dockerfile. As mentioned earlier, it's just a plain text file. Once you've created a Dockerfile and added all your instructions, you can use it to build an image using the docker build command. The format for this command is:

docker build [OPTIONS] <PATH or URL> | -

The docker build command takes some arguments and options, you can display them with a short description using the -help switch, as with any other Docker command:

docker build -help

There are options to tweak the build process by specifying the CPU and memory setup or turning off the cache, for example. You can also tag the new repository after the build, using the -t option, ...

Get Developing with Docker now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.