Docker 101 : Docker images, repository and the "Dockerfile"
Searching for images:
To look for images in the docker repository, we use the below command to look for "debian" images for example:
To pull "debian" from the default repository and run it, we use:
We build an image locally by running the below command:
Example:
Pulls and runs the "truecommand" image and publishes the ports. It maps port 80 on the host to port 80 on application running in the container.
Building a docker image:
We build an image locally by running the below command:
Builds the base image from a "debian" or "ubuntu" image for example "FROM debian:latest".
The ADD instruction copies local files or remote URLs, then adds them to the image at the destination path.
Default command that is executed when the container starts, it can be easily overridden using the command line "docker run image command".
This information could be viewed using the command : "docker inspect image_name".
The USER instruction sets the user under which all the following instructions will be run.
The "Dockerfile" instructions and the final image:
The output of each of these above instructions builds a layer and all the layers combined constitute a docker image.
Comments