Mirroring the build process: Write dockerfile file, execute docker build build Mirror the last instance docker run run container.
docker build -t mycentos:. 1.01
build image, the final name for mycentos, docker build -f / root / firstdockerfile / Dockerfile2 -t cmdtest -f parameters need to add an absolute path, when the file is not currently dockerfile need to use this parameter.
docker run -it mycentos: 1.01 / bin / mirror instance running bash, a container is run.
dockerfile command related to the
preparation of dockerfile documents related to the portion of the command is as follows:
- FROM: Specify a base image, if no other, you can use sratch Mirror, Mirror is a mirror image of the ancestors
- MAINTAINER: information specified defenders
- ENV: setting environment variables, which could be cited in the dockerfile
- RUN: execute the command, for example, is mounted such command RUN to each image layer, each row is a mirror layer
- EXPOSE: Foreign exposed port number
- CMD: Command executed when starting the specified container, if there is more, only the last one will take effect, and ENTRYPOINT is added to perform.
- ENTRYPOINT: when a container is specified command execution, but the difference is entrypoint CMD parameters are appended to the command line, which is more powerful.
- ONBUILD: If the subclass inherits the parent, then the parent class onbuild will be executed.
- VOLUME: Mounting data volume