Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Difference between revisions of "Rock3/dev/install-docker-engineer-on-docker"

< Rock3‎ | dev
(Created page with "{{rock3_header}} {{Languages|rock3/dev/install-docker-engineer-on-docker}} === Install Docker Engine on Debian ===")
 
Line 3: Line 3:
 
{{Languages|rock3/dev/install-docker-engineer-on-docker}}
 
{{Languages|rock3/dev/install-docker-engineer-on-docker}}
  
=== Install Docker Engine on Debian ===
+
=== 0.Uninstall old versions ===
 +
 
 +
  sudo apt-get remove docker docker-engine docker.io containerd runc
 +
 
 +
=== 1.Install Docker Engine on Debian ===
 +
1 Install using the repository.Update the apt package index and install packages to allow apt to use a repository over HTTPS:
 +
  sudo apt-get update
 +
  sudo apt-get install \
 +
    ca-certificates \
 +
    curl \
 +
    gnupg \
 +
    lsb-release
 +
2 Add Docker’s official GPG key:
 +
  sudo mkdir -p /etc/apt/keyrings
 +
  curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
 +
3 Use the following command to set up the repository:
 +
  echo \
 +
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
 +
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
 +
4 Install Docker Engine
 +
  sudo apt-get update
 +
  sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
 +
5 The docker installer uses iptables for nat. Unfortunately Debian uses nftables. You can convert the entries over to nftables or just setup Debian to use the legacy iptables.
 +
  sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
 +
  sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
 +
  sudo service docker start
 +
=== 2 Test Docker===
 +
  sudo docker run hello-world
 +
=== 2 Check docker service status ===
 +
 
 +
  sudo systemctl status docker
 +
 
 +
And it shows this.
 +
  ● docker.service - Docker Application Container Engine
 +
  Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: e
 +
  Active: active (running) since Thu 2022-07-14 15:24:57 UTC; 4min 48s ago
 +
    Docs: https://docs.docker.com
 +
Main PID: 5632 (dockerd)
 +
    Tasks: 10
 +
  Memory: 37.4M
 +
  CGroup: /system.slice/docker.service
 +
          └─5632 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/contain

Revision as of 07:31, 14 July 2022

0.Uninstall old versions

 sudo apt-get remove docker docker-engine docker.io containerd runc

1.Install Docker Engine on Debian

1 Install using the repository.Update the apt package index and install packages to allow apt to use a repository over HTTPS:

 sudo apt-get update
 sudo apt-get install \
   ca-certificates \
   curl \
   gnupg \
   lsb-release

2 Add Docker’s official GPG key:

 sudo mkdir -p /etc/apt/keyrings
 curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

3 Use the following command to set up the repository:

 echo \
 "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
 $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

4 Install Docker Engine

 sudo apt-get update
 sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

5 The docker installer uses iptables for nat. Unfortunately Debian uses nftables. You can convert the entries over to nftables or just setup Debian to use the legacy iptables.

 sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
 sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
 sudo service docker start

2 Test Docker

 sudo docker run hello-world

2 Check docker service status

 sudo systemctl status docker

And it shows this.

 ● docker.service - Docker Application Container Engine
  Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: e
  Active: active (running) since Thu 2022-07-14 15:24:57 UTC; 4min 48s ago
    Docs: https://docs.docker.com
Main PID: 5632 (dockerd)
   Tasks: 10
  Memory: 37.4M
  CGroup: /system.slice/docker.service
          └─5632 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/contain