How To Install and Use Docker Engine on Debian 11 Tutorial. In this tutorial we will introduce Docker Engine with their main advantages and after that we will move onto installation phase. We will also explain some basic Docker commands that are used to manage the Docker containers.
In the past few years Docker has grown exceptionally popular amongst organizations due to its features of creating simple tool and packaging approach that bundles up all application dependencies inside a container which then runs on Docker Engine.
Docker’s containers technology makes development highly scalable as it separates your applications from your infrastructure to be able to deliver software quickly. Shipping, testing and deploying the code is made quickly with less delays in applications delivery.
The Docker Engine (DE) is an open source containerization technology. It is the core component of the Docker that you install on the host machine. It is a lightweight, scalable runtime environment and a core client server technology that works by creating and containerizing your applications.
A Docker engine is made up of three elements to act as a client server application:
Server: Server with a Docker daemon (dockerd) process. It is responsible to create and manage Docker objects such as containers, images, volumes and networks.
CLI: Command Line Interface (CLI) is where you can run Docker commands.
REST API: It is responsible to create communication link between Docker and programs. It helps ‘dockerd’ in its function using instructions.
The CLI makes use of Docker APIs to communicate and control the Docker daemon (dockerd) via direct commands or scripting. Even other Docker applications leverage the core CLI and API.
Docker makes use of containers as a simple runtime environment for software applications. These share system resources and file system whilst running at OS level. Containerization does not use too many resources as compared to a VM (virtual machine) or a traditional server.
With Docker, IT enterprises can seamlessly create, deploy, run and manage applications within containers. These containers are lightweight and include all dependencies and instructions inside them such as libraries, bins, frameworks, and so on.
Here are the major advantages of using a Docker Engine for software development:
1. Faster deployment
Since Docker is an isolated, virtualized OS environment; it is siloed from local infrastructure, which makes application deployment much faster and easier. It does not have a boot time when you start containers instances. Besides, you can even share already existing containers to build new applications.
2. Better interface
Docker has become popular in past few years as it offers a highly accessible and systematic interface for containerization. It also comprises an open source software repository including base container images. Users can leverage this to build on as they create siloed container environments to run applications.
3. Saves time
DevOps experts can leverage Docker to containerize wide range of applications, without any interference with each other. These containers can be passed on to the quality team for independently testing the functions and processes of the system. Hence, Docker saves time and most importantly, it works on any platform.
4. Consistency
Docker makes sure your applications run seamlessly within multiple environments without any failures. This ensures reliability as developers can work on same application running in different OS and machines without any runtime environment problems.
5. Automation
The Docker platform allows you to automate time consuming, repetitive manual tasks through scheduling. Thus, it boosts team production and greatly reduces human intervention.
6. Supports CI/CD
Docker aims to streamline CI/CD processes it as accelerates your deployments, enhances team efficiencies and simplifies the upgrading process.
In Docker, a container is based upon an image that includes multiple layers. These layers denote every update and change that has ever occurred in the base. This provides you enhanced version control over the container, and helps you easily rollback to a previous version, as and when needed. Plus, this feature also accelerates the entire build process.
8. Cost effective
Containers are lightweight and small packages that do not entertain guest OS. It consumes less memory as compared to VMs and also reuses components, all credits to the images and data volumes. Also, its resource efficiency is higher as it runs entirely on cloud and does not require extensive physical servers.
9. Flexibility
Containers are siloed virtual environments. Each container has its own unique function within a multi container application. Since it has an independent environment, developers can easily work on a specific component of an application without taking the entire application down.
10. Swarm mode
A swarm is a cluster of connected Docker Engine hosts where application services can be started. Docker Engine can deploy manager and worker nodes from an image at runtime instead of deployment. Swarm mode maintains and returns the declared desired state in the event of an outage or scaling event.
11. Shared container libraries
Developers can use open source registry where there is thousands of containers.
At this point, Docker is installed and running. Now, its time to create and run a hello world container in a Docker environment. Run the following command to launch the hello world container:
docker run hello-world
This command will download the hello world Docker image and start it as shown below:
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:13e367d31ae85359f42d637adf6da428f76d75dc9afeb3c21faea0d976f5c651
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
You can now verify the downloaded Docker image using the following command:
docker images
You should see the hello world Docker image in the following output:
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest feb5d9fea6a5 9 months ago 13.3kB
In this section of how To Install and Use Docker Engine on Debian 11, we will show you how to use Docker container. To search for any Docker image, use the following syntax:
docker search image-name
For example, to search for an Centos image, run the following command:
docker search centos
You will get a list of all Centos images in the following output:
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
centos The official build of CentOS. 7205 [OK]
centos/systemd systemd enabled base container. 108 [OK]
centos/mysql-57-centos7 MySQL 5.7 SQL database server 95
kasmweb/centos-7-desktop CentOS 7 desktop for Kasm Workspaces 21
centos/nginx-112-centos7 Platform for running nginx 1.12 or building … 16
kasmweb/core-centos-7 CentOS 7 base image for Kasm Workspaces 3
continuumio/centos5_gcc5_base 3
couchbase/centos7-systemd centos7-systemd images with additional debug… 1 [OK]
spack/centos7 CentOS 7 with Spack preinstalled 1
bitnami/centos-extras-base 0
couchbase/centos-72-jenkins-core 0
fnndsc/centos-python3 Source for a slim Centos-based Python3 image… 0 [OK]
bitnami/centos-base-buildpack Centos base compilation image 0 [OK]
couchbase/centos-69-sdk-build 0
couchbase/centos-70-sdk-build 0
spack/centos-stream 0
couchbase/centos-72-java-sdk 0
starlingx/stx-centos StarlingX centos 0
ibmcom/fhe-toolkit-centos-amd64 The IBM Fully Homomorphic Encryption (FHE) T… 0
ibmcom/fhe-toolkit-centos The IBM Fully Homomorphic Encryption (FHE) T… 0
apache/couchdbci-centos Apache CouchDB CI CentOS 0
silintl/openldap OpenLDAP base image on Centos 6 0 [OK]
datadog/centos-i386 0
spack/centos6 CentOS 6 with Spack preinstalled 0
couchbase/centos-69-sdk-nodevtoolset-build 0
From the above list, download the Centos image using the following command:
docker pull centos:latest
This will download the Centos image from the Docker Hub registry:
latest: Pulling from library/centos
a1d0c7532777: Pull complete
Digest: sha256:a27fd8080b517143cbbbab9dfb7c8571c40d67d534bbdee55bd6c473f432b177
Status: Downloaded newer image for centos:latest
docker.io/library/centos:latest
You can verify the downloaded image using the following command:
docker images
You will get the following output:
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest feb5d9fea6a5 9 months ago 13.3kB
centos latest 5d0da3dc9764 9 months ago 231MB
To create container from the downloaded Centos image, run the following command:
docker run -it centos
This will create a container from the Centos image and connect to the container shell as shown below:
[root@71581505c036 /]#
Here, you can install any package inside the Centos container. Now, run the following command to exit from the Centos container:
exit
To create a create a container from the Centos image and start it in background, run the following command:
docker run -dit centos
You can now verify the running container using the following command:
docker ps
You should see the running container in the following output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ba772a1b4be2 centos "/bin/bash" 7 seconds ago Up 6 seconds practical_bhaskara
How To Install and Use Docker Engine on Debian 11 Conclusion
In this post we showed you how to install Docker Engine on Debian 11 server. We also explained how to interact with Docker with different commands. I hope this guide will be useful to manage the Docker container. Docker is one of the best platform that changed the way software development used to be. It provides tremendous economies of scale and makes development scalable and simply user friendly.
A container provides orchestration across multiple public and private clouds, to simplify your environments and improve business performance and operational performance. It is vital part of hybrid cloud strategy that optimizes and modernizes your IT environment.
I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.
41vote
Article Rating
Subscribe
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.
DisagreeAgree
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.