Creating a custom base image
Docker has a rich library of base images, and we strongly recommend that you select a lean image that fits your application well. However, you may choose to custom-build your base image from the get go. Here, in this recipe, we will use debootstrap
to create our Ubuntu 18.04 LTS (Xenial Xerus) base image. The debootstrap
utility can create any Debian-based system by downloading it from the appropriate repository.
Getting ready
Install debootstrap
on any Debian-based system using the following command:
$ apt-get install debootstrap
How to do it...
Perform the following steps:
- Create the directory on which you want to populate all the distribution files:
$ mkdir xenial
- Now, using
debootstrap
, install Xenial Xerus inside the directory we created earlier:
$ sudo debootstrap xenial ./xenial
You will see the directory tree, similar to any Linux root filesystem, inside the directory in which Xenial Xerus is installed:
$ ls ./xenialbin boot dev etc home lib lib64 media...