What Are Image, Container, Volume, and Network in Docker? Understanding the 4 Core Concepts
G
GnurtFull-stack developer
6 min read
In this article
When working with Docker, you will frequently use four core concepts: Image, Container, Volume, and Network. Simply put, an image is the blueprint, and a container is the image running. A volume keeps data, while a network connects containers to each other. These four concepts follow an order. First comes the blueprint, then the running copy. The running copy raises two problems, data and connection, which the volume and the network solve. If you are just starting out, read What Is Docker first.
What Is an Image?
An image is a read-only blueprint: you use it to create containers, and you never edit it directly. To change anything, you edit the recipe (the Dockerfile) and build a new image. A Dockerfile is a text file that records each step used to make the image.
Think of an image as a recipe. You can use the same recipe to prepare many dishes. In the same way, you can use one image to create multiple containers. Each container starts with the same image but runs independently.
An image is made of multiple layers, each adding a piece of content such as a library or source code. Docker can reuse these layers to speed up building the image.
One image creates many identical containers.
What Is a Container?
A container is an image running: your application runs inside it.
Creating, stopping, and deleting a container takes only a few seconds. This is because a container shares the operating system kernel of the computer you are using. It does not need to boot a complete separate operating system like a virtual machine. A virtual machine is a complete virtual computer running inside the real machine, with its own operating system. From one image, you can create and run many containers at the same time.
A container is usually in one of two main states: running or stopped. Deleting a container makes the running copy disappear, but the image remains, ready to create a new container.
What Is a Volume?
When a container is deleted, the data inside it is lost too. This is where a volume comes in. A volume is storage that lives outside the container, managed by Docker. Data you write to a volume is not inside the container.
Thanks to that, data survives even when you delete the container. You create a new container and attach the old volume again. The application can keep using the data from before.
What Is a Network?
A simple application may need only one container. But in real applications, many parts usually need to connect to each other. A web application, for example, needs to query a database. A network is a private network for containers, made for exactly that. Containers on the same network can call each other by name. Docker finds the right address, so you do not need to remember IP addresses. For example, the web container can call the database container by the name db. This private network exists only inside Docker. No one on the internet can reach it directly.
How Do the Four Concepts Fit Together?
Let’s look at a complete example: a web application and MySQL (a popular database management system).
Imagine you are building a web application that uses MySQL. First, you create the web container from the application’s image and a MySQL container from the MySQL image. The two containers connect to each other through the network, while MySQL’s data is stored in the volume.
When a user visits the website, the web container receives the request and queries MySQL through the network. MySQL reads the data from the volume and returns the result to the web container.
If the MySQL container is deleted and recreated, you only need to attach the old volume again. The data is still there. The web container can keep connecting to the MySQL service by the same name as before.
The web container connects to the database container through the network, while the database’s data is kept in the volume.
A Quick Look with a Few Commands
You can open a Terminal and try these 4 commands to see what your machine has. They only show information — they do not change or delete anything on your machine.
docker images — See the list of images on your machine.
docker ps — See the containers that are running.
docker volume ls — See the list of volumes.
docker network ls — See the list of networks.
Common Misconceptions
Wrong
Right
Image and container are the same thing.
An image is the blueprint. A container is an image running, created from that image.
Deleting a container deletes all the data.
Deleting a container only deletes the data inside the container. Data written to a volume is still there after the container is deleted, because the volume lives outside the container.
A volume is just an ordinary folder inside the container.
A volume is not an ordinary folder inside the container. Docker manages the volume and it lives outside the container, so the data in it is not lost when the container is deleted. You can think of it as an external drive: you attach it to the container, and when the container is deleted, the drive is still there.
The Docker network is the internet.
The Docker network is not the internet. It is a private network for containers to talk to each other — only containers on the same network can call each other.
Frequently Asked Questions
Can many containers share one image?
Yes. One image can create many containers. Each container runs separately. A change in one container does not affect the other containers.
Does a container need a network?
Not always. A container can run on its own without connecting to any other container. But an application may have many parts that need to communicate, like a web app and a database. In that case, a network helps the containers connect more safely.
What happens to data if I don’t use a volume?
The data is stored in the container’s writable layer, which is removed when the container is deleted. To keep data safe, attach a volume to the important data.
Are a volume and an image the same thing?
No. An image holds the application’s source code. It also holds everything the application needs to run (libraries, configuration…). All of it is packaged in advance following the instructions in the Dockerfile. A volume only holds data. When the data in a volume changes, the image does not change.
Next Step
Open a terminal and run docker images, then docker ps, to see which Images and Containers your machine already has. Then Writing a Dockerfile for a Web App uses these four concepts. It packages a Node.js app into an Image and runs it as a Container. Next, Docker Compose for a Web App with a Database runs the app together with MySQL from one config file.
Sources
The links below were checked and confirmed to load on November 2, 2026.
In the previous article, our small online shop had four jobs: accounts, products, cart and orders, and confirmation email. Suppose you have already split them into four services. Now a very practical question comes up. When a customer clicks “Place order”, how does the order service know the price of a product? And how does it...
Picture this: your laptop is at home, your phone is with you, and a server sits somewhere else. To open the server’s admin page from outside, you usually have to open a port on your router — which means configuring the router and leaving that port exposed to the internet. Tailscale skips that step: it connects...
Comments
You can use your Google account to comment. Google only shares your verified name and email address to display your name. You can log out at any time.
Sign in with GoogleNo comments yet. Be the first!