Go back
One can create an image using a script called a Dockerfile, a script with instructions on how to build an image. Each instruction may result in an intermediate image created in your local docker repository.
Commonly used Dockerfile instructions
- FROM [base-image]
- MAINTAINER [name] [email]
- RUN [command]
- ADD [src] [dest]
- CMD [command]
- EXPOSE [port]
Layering Commits
RUN deserves a special mention: this instruction enables an image to be composed of snapshots, with each snapshot layered on top of another.
Building
To build an image from a Dockerfile, run this command from where the Dockerfile is kept:
$ docker build .To view which images are created, run:
$ docker imagesRecommended Reading