Choose the best Docker image for the job at hand

0

Docker images have revolutionized the computing world, but not all images are created equal. Let’s see how to choose the best Docker image for the job at hand. Because while there are many appropriate images your organization could choose from, the best option depends on its context.

The difference in requirements between production use and quick and dirty Docker images is huge. For personal use, a quick disposable image works. For production images, official, stable and well-supported images work best. A single WordPress image is good for personal use, but not for a business. That said, WordPress is available as an official image.

In production, it’s best to build your own container images to ensure Docker image quality.

Superimposed images

Part of the flexibility of Docker images is that the system is built by stacking layers. While it may seem less than ideal, the leanness of a base image is optimized for performance with built-in extensibility and flexibility.

Each command execution adds another layer. The previous layer becomes read only as additional layers are added. Image updates also create additional layers. For example, use the following command to see the layers of an Ubuntu image:

     docker history ubuntu

Figure 1 shows an example of the layers on the base Ubuntu image.

Figure 1. Ubuntu image layers.

Image layers also help ensure that additional software can be installed over standard base images to create a new server while continuing to share a common known base installation. This reduces the maintenance required.

For ease of use, Docker offers several predefined images. Companies can create their own, but the most common is Docker Hub, which is the default for most new users.

Official vs Unofficial Images

Image integrity is critical. Users should distinguish between officially approved images and third-party images. While most of the available images are well-intentioned, some can be downright malicious: some seemingly popular images contain hidden cryptomining malware that’s easy to miss.

Luckily, there is a way to tell the official and unofficial versions apart. To limit results to official images only, use the following syntax:

     docker search --filter=is-official=true nginx
Screenshot of a Docker search for official images
Figure 2. A Docker search for official images.

Useful official Docker images

Here are some of the most useful Docker images:

Ubuntu. It is one of the most downloaded Docker images in the industry. It is the official operating system of Ubuntu and it is used as the base image for almost all types of server operating system. It’s a small, thin image designed to be built. This image is easy to expand and include the resources needed for a given task.

Alpine. For those who want something smaller, the Alpine Linux Docker image is the way to go. It’s great to run on systems with limited resources, but Alpine management requires a higher skill level and isn’t as user-friendly as Ubuntu. Unless there is a compelling reason to use Alpine, stick to the main Ubuntu environment.

Nginx. Nginx is the current web server and proxy. This image is designed to be tiny and cater for out-of-the-box use via a mount point for files.

MySQL. MySQL databases are a staple of the open source world. This container is easy to download, has a disposable SQL server for experimentation, and can be easily removed when finished. This is part of the benefits of Docker containers in general: build, use and discard.

Say it again. For those looking for a fast in-memory database, Say it again is a good call. Redis is easy and fast to use.

Elastic pile. Formerly known as ELK, which stands for Elasticsearch, Logstash, and Kibana, Elastic Stack provides log storage, search, and visualization. Again, this Docker image is disposable.

WordPress. WordPress is a bit of a wild card. Setting up WordPress manually and securely is a painstaking process. Therefore, it helps to be able to unroll and run WordPress instantly.

Notes of Caution

If your organization uses Docker images for something critical, keep in mind that even when it comes to official images, new images are released and are by default the latest. This means that the image changes, often frequently. Docker Hub offers users the ability to create and use a free repository, so IT admins should make sure they follow image version updates closely.

Ideally keep the images on a suitable private Docker repository. As stated earlier, a personal project varies greatly from a highly managed and audited production environment to a medium-sized enterprise. It is possible to use Docker images effectively, but be careful.

Share.

Comments are closed.