Low Orbit Flux Logo 2 D

Docker Container vs Image

If you are wondering what the difference is between a Docker container vs image then you have come the right place. A container is just a running instance of an image. A Docker image is used to create an actual Docker container. The image can be thought of kind of like a blueprint. It is an image of a system. A container is the actual runnable system. It can be thought of kind of like a light weight VM. You can have many containers based on a single image.

Docker Container vs Image

Here are a couple good analogies:

You would create an image containing everything you usually need to run your application. For example, you might create an image of an Ubuntu system that runs NGINX and includes HTML and PHP files. You would then use this to create multiple running containers spread across multiple machines in a cluster.

Here are some commands that will help you see what containers and images you have on your system.

docker images Show images
docker ps Show running containers
docker ps -a Show stopped

Docker Container vs Image Example Video

Images: Where Do They Come From?

Docker images can come from a few different places. These include:

Containers: Where Do They Come From?

Containers come from images. When you create or start a container, you specify an image that it will be created from.

Docker Container vs Image

The following two commands will create and run two containers called “smelly-hippo” and “funny-frog” based on the image “ubuntu”.

docker run -tid --name smelly-hippo ubuntu
docker run -tid --name funny-frog ubuntu

You can also create a container without running it like this:

docker create -ti --name smelly-hippo ubuntu