A running instance of an image is called a container. Docker launches them using the Docker images as read-only templates. To use a programming metaphor, if an image is a class, then a container is an instance of a class-a runtime object. Containers are lightweight and portable encapsulations of an environment in which to run applications. To turn an image into a container, the Docker engine takes the image, adds a read/write filesystem on top, and initializes various settings, including network ports, container name, ID, and resource limits (we will be talking about applying resource limits to a container in Chapter 7, Running Containers). To run a container, use the same command we used in the previous chapter when we tested our installation, docker run
:
$ docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
There are a lot of run command options that can be used. Some of them include the network configuration, for...