based on https://training.play-with-docker.com/ops-s1-images/

Basic steps

First, you may want to figure out how to create your images. While there are over 8 million images (as of January 2022) on Docker Hub, it is almost certain that none of them are exactly what you run in your data center today. Even something as common as a Windows OS image would get its tweaks before you run it in production.

We will start with the simplest form of image creation, in which we simply commit one of our container instances as an image. Then, we will explore a more powerful and useful method for creating images, the Dockerfile.


An important distinction about images is between base images and child images.

Another key concept is the idea of official images and user images. (Both of which can be base images or child images.)

To find out more about them, check out the https://docs.docker.com/trusted-content/official-images/


Image creation from a container

Let’s start by running an interactive shell in a Ubuntu container:

docker run -it ubuntu bash

You just grabbed the "ubuntu" image from the Docker Store and are now running the bash shell inside that container.

To customize things a little bit, we will install a package called “figlet” in this container. Your container should still be running, so type the following commands at your Ubuntu container command line:

apt-get update
apt-get install -y figlet
figlet "hello docker"

You should see the words “hello docker” printed out in large ASCII characters on the screen. Go ahead and exit from this container.