1. What is Docker?
Docker is the most widely used container technology. Docker scores points for its simplicity and allows for quickly deploying new services (e.g., web servers, databases). These can be used both in test environments and in production. Docker has become very popular due to its versatility and the many pre-built images available. Compared to virtualization (virtual machines), Docker is easier to replicate, quicker to set up, and scales better. Throughout these guides, I will show the simplicity and extensive functionality of Docker.
2. Installing Docker
Docker can be installed quickly on various systems. It supports major Linux distributions such as Debian, CentOS, Ubuntu, Raspbian, as well as Windows and MacOS.
Detailed instructions for each system can be found on the manufacturer's website.
Here, we will focus on the commonly used systems: Windows and Debian.
2.1 Installing Docker on Linux (Debian)
Now we want to install Docker on Debian 10. Docker is typically installed on a server without a graphical interface. Therefore, we execute all commands in the console (shell).
Now enter the following commands:
# Preparation
apt-get update
apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
# Incorporate Docker GPG key
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
# Incorporate Docker repository
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
After executing these commands, we can start the actual Docker installation. To do this, enter the following:
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io
Now we can test if the installation was successful. To do this, enter:
docker run hello-world
Now the corresponding image will be loaded and then executed.
3. Docker Images and Containers
Docker often uses the terms "Image" and "Container". Let's explain them briefly here.
The starting point of any Docker container is always an Image. In this context, Image does not mean like in virtualization of virtual machines a "virtual hard drive" which contains all data including the operating system. In Docker, an Image is a "Read-Only" file system, which forms the basis for the later container. This means that unlike virtual machines (VMs), the Docker Image is never changed. If new files are added or modified within the container, they are not changed in the Image, but in a so-called "Overlay file system", which is mapped on the Docker host within a directory.
Since Images are never changed, any number of containers can be created from an Image and started simultaneously. A container is thus the "currently running instance" of an Image. Unlike an Image, which only occupies disk space, a Container also uses resources such as CPU and memory.
Due to Docker's high popularity, many applications can be obtained as ready-made Images on the Internet. Currently, there are more than 8.4 million different Images available on the Docker Hub. Most of these Images are freely accessible. Many Images are even created by the official manufacturers and marked as such.
You can also create "Docker Files" yourself with a simple text editor, which can later be converted into an Image.
4. Advantages of Docker
Docker offers many advantages, which is why it is also popularly used in companies. Here's a brief introduction to some criteria:
- Resource-efficient
Containers are much more resource-efficient than virtual machines (VMs). Docker Containers share the kernel of the host system and are therefore much smaller. For example, the popular Linux system "Alpine Linux" is only about 10 MB in size and provides all the necessary programs.
- Scalability
Since all Containers are identical and can be created from the same Image as many times as needed, new servers can be added quickly and the application can be deployed. Docker Swarm and Kubernetes are used for this purpose, which utilize Docker as a foundation.
- Deployment time
Since Docker Containers are created using Images, it takes only a few seconds for a Container to be ready and usable. Moreover, no changes need to be made to the host operating system. Docker Images can be easily customized to your needs with just a few lines of text in a very short time.
5. Docker Use Cases
Dogado.de provides various tested guides that allow you to set up complex server systems like an email server or your own cloud within minutes.
Currently, there are more than 30 guides using Docker available at dogado.de. All of these guides are free and tested for functionality. Additional guides on other exciting topics are regularly added. You can find the guides here:
Presenting all guides in detail would be beyond the scope here. Therefore, here's a brief introduction to some guides:
- BigBlueButton is an open source web conferencing system.
- Grafana visualizes various data such as CPU usage, memory usage graphically.
- Moodle is a popular open source learning platform.
- Mailcow is a complete email server with many extras.
- Mattermost is an open source chat system.
- Nextcloud is an open source cloud that you can run yourself.
- Traefik is a reverse proxy that allows you to run multiple web applications simultaneously on a single port (e.g., 80, 443).
The guides themselves are structured so that you get a brief overview of what to expect, and then you can simply copy the corresponding code. This way, anyone can become a Docker administrator in no time.
6. Docker Compose
With Docker itself, you can only set up one Container at a time. While this works, it is very tedious if you need, for example, 6 Containers for an application. This is where Docker Compose comes in handy. Docker Compose can be downloaded for free from the manufacturer (https://docs.docker.com/compose/). The basis is a "docker-compose.yml" file in the current directory, which contains all the information. For example, it specifies which Containers to start, what parameters to pass, and through which network to communicate. All guides at dogado use Docker Compose, as most projects require multiple Docker Containers. This way, for example, an entire email server can be started with the command "docker-compose up".
7. Docker Hub
Docker Hub is a platform that provides over 8.4 million Docker Images. In addition to many official images from manufacturers, there are also many images created and maintained by individual community members. Anyone can register for free at Docker Hub and provide their own images for everyone. No account is required to download the images. However, if you want to create private repositories (visible only to authorized members), you need to subscribe to a plan (https://www.docker.com/pricing).
Docker Hub offers users a good search function and many categories for sorting. This greatly helps to get an overview.
Each Image has its "own page" on Docker Hub. Here you can find information about the versions provided and what to look out for.