based on:
An image is a read-only template with instructions for creating a Docker container. A Docker registry stores Docker images.
Docker Hub (https://hub.docker.com/) is a public registry that anyone can use, and Docker is configured to look for images on Docker Hub by default; millions of images are available.
A container is a runnable instance of an image. You can create, start, stop, move, or delete a container using the Docker API or CLI. You can connect a container to one or more networks, attach storage to it, or even create a new image based on its current state.
There are three different ways to use containers. These include:
In the following, we will see examples of all three ways to use containers
docker container run hello-world
Images can have multiple versions. For example you could pull a specific version of ubuntu
image as follows:
docker pull ubuntu:12.04
If you do not specify the version number of the image the Docker client will default to a version named latest
.
So for example, the docker pull
command given below will pull an image named ubuntu:latest
: