Difficulty: Beginner
Estimated Time: 10 minutes

This scenario explains the basic of docker storage internals.

You'll get a glimpse of storage, image storage, the copy-on-write mechanism, union file systems, storage drivers, and volumes.

The environment has a Docker installation configured, running on a host called docker. Everything else required we'll launch as containers.

In this tutorial on Docker storage, we learn:

How docker images are stored locally by the Docker engine. How the copy-on-write mechanism and the union file system optimize storage and start up time for Docker containers. The variety of storage drivers compatible with Docker. How volumes provide shared persistent data for Docker containers. With this you can think of mounting a volume and attach deattach to and from the container and safely store your data.

Docker Storage Internals

Step 1 of 5

Step 1

Before going to the tutorial, Can you think on the question, How docker stores the images internally ?

There are lot of place inside docker both at engine level and container level that use or work with storage. Let's deep dive into the storage.

Let’s imagine we want to pull a Docker image from a registry, like so:

docker pull nginx

When you hit enter, docker search for the respective image into local repository, if it's not found, docker will pull the nginx image from the Docker Hub. At Docker Hub, you can see all the images with versions and its respective Dockerfile. Once the pulling completes, it will added into your local repository and managed by docker engine.

We can verify this is the case by listing the local images:

docker images

Now if we launch nginx image, it will spin up quickly as its store locally.

We can launch it like so,

docker run -d --name web1 -p 8081:80 nginx

This command maps port 80 of the container to port 8081 of the host machine. After it has run, you can connect at port 8081 on host(docker is the host in our scenario) to verify that nginx responds. Just run the next command,

curl http://docker:8081/

This step we can easily visualize, but whats happening behind the scene, as far as this containers file system ? To understand it we need to look at the copy-on-write mechanism.

This tab will not be visible to users and provides only information to help authors when creating content.

Creating Katacoda Scenarios

Thanks for creating Katacoda scenarios. This tab is designed to help you as an author have quick access the information you need when creating scenarios.

Here are some useful links to get you started.

Running Katacoda Workshops

If you are planning to use Katacoda for workshops, please contact [email protected] to arrange capacity.

Debugging Scenarios

Below is the response from any background scripts run or files uploaded. This stream can aid debugging scenarios.

If you still need assistance, please contact [email protected]