Index

based on

Doing More With Docker Images

Basic steps

First thing you may want to do is figure out how to create our own images. While there are over 8 millions 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 own tweaks before you actually 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 much more powerful and useful method for creating images, the Dockerfile.


An important distinction with regard to 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 Official Images Documentation.


Image creation from a container

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

docker run -it ubuntu bash

As you know from before, you just grabbed the image called “ubuntu” from 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"