Install Docker on Linux

1. Install on LinuxMint 19.2


sudo vi /etc/apt/sources.list.d/additional-repositories.list
deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable

sudo apt update
# E: 仓库 “https://download.docker.com/linux/ubuntu bionic InRelease” 没有数字签名
# sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 7EA0A9C3F273FCD8
# sudo apt update

sudo apt-get install docker-ce

systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-12-09 10:47:24 CST; 9min ago
     Docs: https://docs.docker.com
 Main PID: 9605 (dockerd)
    Tasks: 8
   CGroup: /system.slice/docker.service
           └─9605 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

12月 09 10:47:24 dbhome dockerd[9605]: time=2019-12-09T10:47:24.341558270+08:00 level=warning msg=Your kernel does not support swap memory limit
12月 09 10:47:24 dbhome dockerd[9605]: time=2019-12-09T10:47:24.341890219+08:00 level=warning msg=Your kernel does not support cgroup rt period
12月 09 10:47:24 dbhome dockerd[9605]: time=2019-12-09T10:47:24.341993003+08:00 level=warning msg=Your kernel does not support cgroup rt runtime
12月 09 10:47:24 dbhome dockerd[9605]: time=2019-12-09T10:47:24.342193221+08:00 level=info msg=Loading containers: start.
12月 09 10:47:24 dbhome dockerd[9605]: time=2019-12-09T10:47:24.407106327+08:00 level=info msg=Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to
12月 09 10:47:24 dbhome dockerd[9605]: time=2019-12-09T10:47:24.440850281+08:00 level=info msg=Loading containers: done.
12月 09 10:47:24 dbhome dockerd[9605]: time=2019-12-09T10:47:24.488338471+08:00 level=info msg=Docker daemon commit=633a0ea838 graphdriver(s)=overlay2 version=19.03.5
12月 09 10:47:24 dbhome dockerd[9605]: time=2019-12-09T10:47:24.488642082+08:00 level=info msg=Daemon has completed initialization
12月 09 10:47:24 dbhome systemd[1]: Started Docker Application Container Engine.
12月 09 10:47:24 dbhome dockerd[9605]: time=2019-12-09T10:47:24.504678994+08:00 level=info msg=API listen on /var/run/docker.sock


# let non-root user can operate
sudo usermod -aG docker ${USER}
newgrp docker

martin@dbhome:~$ docker version 
Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea838
 Built:             Wed Nov 13 07:29:52 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.5
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.12
  Git commit:       633a0ea838
  Built:            Wed Nov 13 07:28:22 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

2. Install on CentOS 7.7

curl -fsSL https://get.docker.com | sudo sh -

sudo usermod -aG docker ${USER}

[martin@dbhome ~]$ docker version
Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea
 Built:             Wed Nov 13 07:25:41 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.5
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.12
  Git commit:       633a0ea
  Built:            Wed Nov 13 07:24:18 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

sudo systemctl enable docker
sudo systemctl start docker
systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2019-12-09 10:43:05 CST; 15min ago
     Docs: https://docs.docker.com
 Main PID: 1694 (dockerd)
    Tasks: 11
   Memory: 128.8M
   CGroup: /system.slice/docker.service
           └─1694 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Dec 09 10:43:03 dbhome dockerd[1694]: time=2019-12-09T10:43:03.881502705+08:00 level=info msg=ccResolverWrapper: sending update ...ule=grpc
Dec 09 10:43:03 dbhome dockerd[1694]: time=2019-12-09T10:43:03.881510471+08:00 level=info msg=ClientConn switching balancer to \...ule=grpc
Dec 09 10:43:04 dbhome dockerd[1694]: time=2019-12-09T10:43:04.053189418+08:00 level=info msg=[graphdriver] using prior storage ...verlay2
Dec 09 10:43:04 dbhome dockerd[1694]: time=2019-12-09T10:43:04.078130977+08:00 level=info msg=Loading containers: start.
Dec 09 10:43:05 dbhome dockerd[1694]: time=2019-12-09T10:43:05.215782575+08:00 level=info msg=Default bridge (docker0) is assign...address
Dec 09 10:43:05 dbhome dockerd[1694]: time=2019-12-09T10:43:05.631510228+08:00 level=info msg=Loading containers: done.
Dec 09 10:43:05 dbhome dockerd[1694]: time=2019-12-09T10:43:05.877685131+08:00 level=info msg=Docker daemon commit=633a0ea grap...=19.03.5
Dec 09 10:43:05 dbhome dockerd[1694]: time=2019-12-09T10:43:05.878225441+08:00 level=info msg=Daemon has completed initialization
Dec 09 10:43:05 dbhome dockerd[1694]: time=2019-12-09T10:43:05.967569076+08:00 level=info msg=API listen on /var/run/docker.sock
Dec 09 10:43:05 dbhome systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.