docker 安装(ubuntu)
更新apt库安装包索引
sudo apt-get update
由于访问docker库需要使用https,需要安装https的依赖包
$sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gunpg-agent \ software-properties-common
添加docker的官方GPG公钥:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
校验公钥是否添加成功,通过搜索公钥fingerprint后八位即可验证(9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
):
$ sudo apt-key fingerprint 0EBFCD88
通过下面命令将stable(稳定版)docker库添加到本地apt仓库
$ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
更新本地仓库包索引:
sudo apt-get update
列出本地仓库可用的版本列表:
apt-cache madison docker-ce
执行安装: sudo apt-get install docker-ce=5:19.03.6~3-0~ubuntu-bionic docker-ce-cli=5:19.03.6~3-0~ubuntu-bionic containerd.io
报错,提示执行: sudo dpkg --configure -a
执行之:
执行Ok后继续安装:
liwutao@liwutao:/var/cache/apt/archives$ sudo apt-get install docker-ce=5:19.03.6~3-0~ubuntu-bionic docker-ce-cli=5:19.03.6~3-0~ubuntu-bionic containerd.io Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: aufs-tools cgroupfs-mount libltdl7 linux-modules-extra-4.15.0-88-generic pigz The following NEW packages will be installed: aufs-tools cgroupfs-mount containerd.io docker-ce docker-ce-cli libltdl7 pigz The following packages will be upgraded: linux-modules-extra-4.15.0-88-generic 1 upgraded, 7 newly installed, 0 to remove and 18 not upgraded. 1 not fully installed or removed. Need to get 85.8 MB/119 MB of archives. After this operation, 554 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 pigz amd64 2.4-1 [57.4 kB] Get:2 http://archive.ubuntu.com/ubuntu bionic/universe amd64 aufs-tools amd64 1:4.9+20170918-1ubuntu1 [104 kB] Get:3 https://download.docker.com/linux/ubuntu bionic/stable amd64 containerd.io amd64 1.2.13-1 [20.1 MB] Get:4 http://archive.ubuntu.com/ubuntu bionic/universe amd64 cgroupfs-mount all 1.4 [6,320 B] Get:5 http://archive.ubuntu.com/ubuntu bionic/main amd64 libltdl7 amd64 2.4.6-2 [38.8 kB] Get:6 https://download.docker.com/linux/ubuntu bionic/stable amd64 docker-ce-cli amd64 5:19.03.6~3-0~ubuntu-bionic [42.5 MB] Get:7 https://download.docker.com/linux/ubuntu bionic/stable amd64 docker-ce amd64 5:19.03.6~3-0~ubuntu-bionic [22.9 MB] Get:7 https://download.docker.com/linux/ubuntu bionic/stable amd64 docker-ce amd64 5:19.03.6~3-0~ubuntu-bionic [22.9 MB] Fetched 73.4 MB in 19min 43s (62.0 kB/s) (Reading database ... 68238 files and directories currently installed.) Preparing to unpack .../0-linux-modules-extra-4.15.0-88-generic_4.15.0-88.88_amd64.deb ... Unpacking linux-modules-extra-4.15.0-88-generic (4.15.0-88.88) over (4.15.0-88.88) ... Selecting previously unselected package pigz. Preparing to unpack .../1-pigz_2.4-1_amd64.deb ... Unpacking pigz (2.4-1) ... Selecting previously unselected package aufs-tools. Preparing to unpack .../2-aufs-tools_1%3a4.9+20170918-1ubuntu1_amd64.deb ... Unpacking aufs-tools (1:4.9+20170918-1ubuntu1) ... Selecting previously unselected package cgroupfs-mount. Preparing to unpack .../3-cgroupfs-mount_1.4_all.deb ... Unpacking cgroupfs-mount (1.4) ... Selecting previously unselected package containerd.io. Preparing to unpack .../4-containerd.io_1.2.13-1_amd64.deb ... Unpacking containerd.io (1.2.13-1) ... Selecting previously unselected package docker-ce-cli. Preparing to unpack .../5-docker-ce-cli_5%3a19.03.6~3-0~ubuntu-bionic_amd64.deb ... Unpacking docker-ce-cli (5:19.03.6~3-0~ubuntu-bionic) ... Selecting previously unselected package docker-ce. Preparing to unpack .../6-docker-ce_5%3a19.03.6~3-0~ubuntu-bionic_amd64.deb ... Unpacking docker-ce (5:19.03.6~3-0~ubuntu-bionic) ... Selecting previously unselected package libltdl7:amd64. Preparing to unpack .../7-libltdl7_2.4.6-2_amd64.deb ... Unpacking libltdl7:amd64 (2.4.6-2) ... Setting up aufs-tools (1:4.9+20170918-1ubuntu1) ... Setting up linux-modules-extra-4.15.0-88-generic (4.15.0-88.88) ... Setting up containerd.io (1.2.13-1) ... Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service. Setting up cgroupfs-mount (1.4) ... Setting up libltdl7:amd64 (2.4.6-2) ... Setting up docker-ce-cli (5:19.03.6~3-0~ubuntu-bionic) ... Setting up pigz (2.4-1) ... Setting up docker-ce (5:19.03.6~3-0~ubuntu-bionic) ... Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service. Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket. Processing triggers for libc-bin (2.27-3ubuntu1) ... Processing triggers for systemd (237-3ubuntu10.38) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... Processing triggers for ureadahead (0.100.0-21) ... Processing triggers for linux-image-4.15.0-88-generic (4.15.0-88.88) ... /etc/kernel/postinst.d/initramfs-tools: update-initramfs: Generating /boot/initrd.img-4.15.0-88-generic I: The initramfs will attempt to resume from /dev/sda4 I: (UUID=c930ee23-9416-4e50-8959-d67def1b18fd) I: Set the RESUME variable to override this. /etc/kernel/postinst.d/x-grub-legacy-ec2: Searching for GRUB installation directory ... found: /boot/grub Searching for default file ... found: /boot/grub/default Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst Searching for splash image ... none found, skipping ... Found kernel: /vmlinuz-4.15.0-88-generic Found kernel: /vmlinuz-4.15.0-76-generic Found kernel: /vmlinuz-4.15.0-88-generic Found kernel: /vmlinuz-4.15.0-76-generic Updating /boot/grub/menu.lst ... done /etc/kernel/postinst.d/zz-update-grub: Sourcing file `/etc/default/grub' Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.15.0-88-generic Found initrd image: /boot/initrd.img-4.15.0-88-generic Found linux image: /boot/vmlinuz-4.15.0-76-generic Found initrd image: /boot/initrd.img-4.15.0-76-generic done
完成安装。