Skip to main content

How To Install Docker Engine on Debian 11


Docker is an open-source software to easily create and run applications in an isolated environment called containers from any application. It provides an efficient way to package applications with their libraries and other dependencies into a standardized unit for software development.

Docker containers are much faster and more efficient than a virtual machine because they don't have to run an entire operating system, just the executable that serves the application.

Here, we will see how to install Docker Comunity Edition (CE) on Debian 11.

Note: Docker requires a 64-bit version of Debian OS.

Install Docker on Debian 11

Remove Old Versions

First, uninstall the older versions of Docker packages called docker or docker-engine, along with dependencies from your system. However, this uninstallation would not remove existing Docker volumes, images, and networks found under the /var/lib/docker/ directory.
sudo apt remove -y docker docker-engine docker.io containerd runc

Setup Docker Repository

Install the below packages to let apt have the support of the HTTPS method.
sudo apt update sudo apt install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common

Add the Docker's GPG key to your system.
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Add the Docker repository to the system by running the below command.
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list

Update the repository index.
sudo apt update

Install Docker Engine

Install Docker Engine using the apt command.
sudo apt install -y docker-ce docker-ce-cli containerd.io

Check the Docker version post the installation.
docker -v

Output:
Docker version 20.10.8, build 3967b7d

By now, the Docker service should be up and running.
sudo systemctl status docker

Output:
● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2021-08-21 12:31:37 CDT; 1min 39s ago TriggeredBy: ● docker.socket Docs: https://docs.docker.com Main PID: 18894 (dockerd) Tasks: 8 Memory: 31.3M CPU: 448ms CGroup: /system.slice/docker.service └─18894 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock Aug 21 12:31:37 debian11.itzgeek.local dockerd[18894]: time="2021-08-21T12:31:37.192715381-05:00" level=info msg="scheme \"unix\" not registered, fallback to default s> Aug 21 12:31:37 debian11.itzgeek.local dockerd[18894]: time="2021-08-21T12:31:37.192736530-05:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///r> Aug 21 12:31:37 debian11.itzgeek.local dockerd[18894]: time="2021-08-21T12:31:37.192749042-05:00" level=info msg="ClientConn switching balancer to \"pick_first\"" modu> Aug 21 12:31:37 debian11.itzgeek.local dockerd[18894]: time="2021-08-21T12:31:37.429344966-05:00" level=info msg="Loading containers: start." 

Verify Docker Installation

To test the Docker installation, we will run the hello-world container.

sudo docker run hello-world

The below output confirms that you have installed Docker Engine correctly on Debian OS.
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world b8dfde127a29: Pull complete Digest: sha256:0fe98d7debd9049c50b597ef1f85b7c1e8cc81f59c8d623fcb2250e8bec85b38 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/ 

Allow Non-root users to run Docker Commands

By default, regular users do not have privileges to run Docker commands because the Docker daemon uses a Unix socket owned by the user root.
docker run hello-world

Output:
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create": dial unix /var/run/docker.sock: connect: permission denied. 

To allow regular Linux users to run Docker containers without prefixing sudo, follow the below steps.

Create a group called docker if it does not exist.
sudo groupadd docker

Create a user if required. Replace itzgeek with your username.
sudo useradd -m -s /bin/bash itzgeek

Add the user to the docker group.
sudo usermod -aG docker itzgeek

Log out and log in back and then run Docker commands without prefixing sudo.
docker run hello-world

Interested Topics

Docker Basic Topics
1: Top Important Docker Commands – Working with Docker Containers
2: Working with Docker Images – Building Docker Images
3: How to Build Docker Images with DockerFile

Docker Advanced Topics
1: How to Setup Docker Private Registry on CentOS 7
2: How to Install and Configure Docker Swarm on CentOS 7

Sumber: disini

Comments

Popular posts from this blog

Cara Disable Antimalware Service Executable di Windows 10

Disadari atau tidak, Windows 10 (dan juga windows-windows lainnya) hadir dengan banyak sekali aplikasi bloatware (aplikasi yang tidak perlu-perlu amat dimiliki oleh end user). Contohnya, adalah aplikasi yang seharusnya sudah tergantikan fungsinya oleh antivirus, seperti Antimalware Service Executable . Aplikasi ini dicurigai membuat Windows 10 mengalami inefisiensi memori/RAM, memakan resource yang tinggi, dengan Load yang tinggi (tanpa limit terkadang). Nah, berikut adalah cara men-disable nya: Tekan tombol Windows + I untuk membuka apliaksi Windows Setting. Pilih icon menu Update and Security Pilih lagi menu disamping kiri Windows Security Pada jendela baru yang muncul, ada pilihan Virus & Threat protection Klik ini Lalu matikan proses Real-time protection tersebut. Dengan Regedit. Buka dialog regedit, Windows + R dan ketik ‘regedit’ Cari Folder regedit ini HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender Buat sebuah DWORD baru dengan klik kanan

Setup Debian 11 Official Repository In sources.list (/etc/apt/sources.list)

When you install Debian 11 using a DVD, the OS installer sets the DVD as the source for getting packages for your system if you didn't choose to scan for network mirrors. Due to this reason, the system would ask you to insert a DVD if the disc is not present in the DVD drive when you try to install any software.  Also, the packages on DVD may not be the latest release.  So, we need to get the packages from the Internet. Media change: please insert the disc labeled 'Debian GNU/Linux 11.0.0 _Bullseye_ - Official amd64 DVD Binary-1 20210814-10:04' in the drive '/media/cdrom/' and press [Enter] The /etc/apt/sources.list file with DVD as a source would look something like below. # deb cdrom:[Debian GNU/Linux 11.0.0 _Bullseye_ - Official amd64 DVD Binary-1 20210814-10:04]/ bullseye contrib main deb cdrom:[Debian GNU/Linux 11.0.0 _Bullseye_ - Official amd64 DVD Binary-1 20210814-10:04]/ bullseye contrib main deb http://security.debian.org/debian-security bullseye-security

Cara Berlangganan ke Akun OnlyFans

Ada dua jenis akun di OnlyFans: akun pengguna dan akun pembuat konten. Jika Anda berlangganan akun OnlyFans, maka Anda adalah pengguna. Sementara beberapa akun pembuat OnlyFans tidak mengenakan biaya untuk melihat konten mereka, yang lain dapat mengenakan biaya bulanan $50. Dalam artikel ini, kami akan menunjukkan cara berlangganan akun OnlyFans di berbagai perangkat. Kami juga akan membahas proses berlangganan akun OnlyFans tanpa kartu kredit atau debit. Cara Berlangganan Akun OnlyFans Tanpa Menggunakan Kartu Kredit Pribadi Anda Sebagai salah satu platform paling populer di industri hiburan dewasa, OnlyFans memiliki 130 juta pelanggan dan 2 juta kreator. Meskipun ada sedikit kontroversi seputar aplikasi ini, ada akun pengguna baru yang dibuat setiap hari. Jika Anda ingin membuat akun pengguna, Anda harus melakukannya di situs OnlyFans. Ingatlah bahwa Anda harus berusia minimal 18 tahun untuk membuat akun OnlyFans.