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, for example:
docker build -t jarek/myapp .
To tag the image into multiple repositories at once, you can also add multiple -t
parameters:
docker build -t jarek/myapp:1.0.0 -t jarek/myapp:latest .
The default set of parameters related to CPU...