docker run
docker run
can be used to create an instance of an image from a local or remote repository. The Docker daemon will kick off a new container in its own filesystem, networking, and it contains its own isolated processes. Since the Docker image is made up of layers docker run
creates a new writable layer on top of the image. This allows the user to customize the container and commit to create a new customized docker image.
Note
The Docker daemon will try to pull the image from the remote repository before creating a container if it doesn't find the image on the host.
The syntax for docker run
is as follows:
docker run [OPTIONS] IMAGE [COMMAND] [ARG..]
The docker run
command needs an image name at the bare minimum to create a container. run
contains the highest number of command-line options, a few of them are listed in the following sections.
Detached versus foreground mode
When you start a container you should be able to decide if you want your container to run in a detached mode or foreground...