Docker 在 UBUNTU 18.4 上安装失败

Docker 在 UBUNTU 18.4 上安装失败
  1. 我尝试安装 docker 但出现错误,然后我搜索了另一种方法,试了一下..现在我在“docker ver”cmd 上出现错误,并且还必须在 docker cmd 前面加上 SUDO..我的日志如下:

日志如下:

To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

nkhwaja@nkhwaja-Latitude-E6510:~$ sudo apt-get update
[sudo] password for nkhwaja:
..
Fetched 252 kB in 1s (251 kB/s)
Reading package lists... Done
nkhwaja@nkhwaja-Latitude-E6510:~$ sudo apt-get install docker-ce
docker-ce-cli containerd.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package docker-ce is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'docker-ce' has no installation candidate
E: Unable to locate package docker-ce-cli
E: Unable to locate package containerd.io
E: Couldn't find any package by glob 'containerd.io'
E: Couldn't find any package by regex 'containerd.io'
nkhwaja@nkhwaja-Latitude-E6510:~$ sudo apt update
...
Fetched 252 kB in 1s (336 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
3 packages can be upgraded. Run 'apt list --upgradable' to see them.
nkhwaja@nkhwaja-Latitude-E6510:~$ apt list --upgradable
Listing... Done
xserver-common/bionic-updates,bionic-updates 2:1.19.6-1ubuntu4.4 all
[upgradable from: 2:1.19.6-1ubuntu4.3]
xserver-xephyr/bionic-updates 2:1.19.6-1ubuntu4.4 amd64 [upgradable
from: 2:1.19.6-1ubuntu4.3]
xwayland/bionic-updates 2:1.19.6-1ubuntu4.4 amd64 [upgradable from:
2:1.19.6-1ubuntu4.3]
nkhwaja@nkhwaja-Latitude-E6510:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer
required:
   efibootmgr libfwup1 libwayland-egl1-mesa
Use 'sudo apt autoremove' to remove them.
The following packages will be upgraded:
   xserver-common xserver-xephyr xwayland
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/1,813 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 169600 files and directories currently installed.)
Preparing to unpack .../xserver-common_2%3a1.19.6-1ubuntu4.4_all.deb ...
Unpacking xserver-common (2:1.19.6-1ubuntu4.4) over
(2:1.19.6-1ubuntu4.3) ...
Preparing to unpack .../xserver-xephyr_2%3a1.19.6-1ubuntu4.4_amd64.deb ...
Unpacking xserver-xephyr (2:1.19.6-1ubuntu4.4) over
(2:1.19.6-1ubuntu4.3) ...
Preparing to unpack .../xwayland_2%3a1.19.6-1ubuntu4.4_amd64.deb ...
Unpacking xwayland (2:1.19.6-1ubuntu4.4) over (2:1.19.6-1ubuntu4.3) ...
Setting up xserver-common (2:1.19.6-1ubuntu4.4) ...
Setting up xserver-xephyr (2:1.19.6-1ubuntu4.4) ...
Setting up xwayland (2:1.19.6-1ubuntu4.4) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
nkhwaja@nkhwaja-Latitude-E6510:~$ sudo apt-get install curl
apt-transport-https ca-certificates software-prop
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package software-prop
nkhwaja@nkhwaja-Latitude-E6510:~$ sudo apt-get install curl
apt-transport-https ca-certificates software-properties-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
ca-certificates is already the newest version (20180409).
ca-certificates set to manually installed.
software-properties-common is already the newest version (0.96.24.32.12).
software-properties-common set to manually installed.
The following packages were automatically installed and are no longer
required:
   efibootmgr libfwup1 libwayland-egl1-mesa
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
   libcurl4
The following NEW packages will be installed:
   apt-transport-https curl libcurl4
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 375 kB of archives.
After this operation, 1,191 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
..Fetched 375 kB in 0s (1,010 kB/s)
Selecting previously unselected package apt-transport-https.
(Reading database ... 169600 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_1.6.12_all.deb ...
Unpacking apt-transport-https (1.6.12) ...
Selecting previously unselected package libcurl4:amd64.
Preparing to unpack .../libcurl4_7.58.0-2ubuntu3.8_amd64.deb ...
Unpacking libcurl4:amd64 (7.58.0-2ubuntu3.8) ...
Selecting previously unselected package curl.
Preparing to unpack .../curl_7.58.0-2ubuntu3.8_amd64.deb ...
Unpacking curl (7.58.0-2ubuntu3.8) ...
Setting up apt-transport-https (1.6.12) ...
Setting up libcurl4:amd64 (7.58.0-2ubuntu3.8) ...
Setting up curl (7.58.0-2ubuntu3.8) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
nkhwaja@nkhwaja-Latitude-E6510:~$ curl -fsSL
https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK
nkhwaja@nkhwaja-Latitude-E6510:~$
nkhwaja@nkhwaja-Latitude-E6510:~$ sudo add-apt-repository "deb
[arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs)
stable"
..Packages [11.0 kB]
Fetched 327 kB in 1s (326 kB/s)
Reading package lists... Done
nkhwaja@nkhwaja-Latitude-E6510:~$ sudo apt update
..Fetched 252 kB in 1s (313 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
nkhwaja@nkhwaja-Latitude-E6510:~$ sudo apt install docker-ce
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer
required:
   efibootmgr libfwup1 libwayland-egl1-mesa
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
   aufs-tools cgroupfs-mount containerd.io docker-ce-cli git git-man
   liberror-perl pigz
Suggested packages:
   git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui
gitk
   gitweb git-cvs git-mediawiki git-svn
The following NEW packages will be installed:
   aufs-tools cgroupfs-mount containerd.io docker-ce docker-ce-cli git
git-man
   liberror-perl pigz
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 90.5 MB of archives.
After this operation, 419 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
..
..
Fetched 90.5 MB in 31s (2,943 kB/s)
Selecting previously unselected package pigz.
(Reading database ... 169617 files and directories currently installed.)
Preparing to unpack .../0-pigz_2.4-1_amd64.deb ...
Unpacking pigz (2.4-1) ...
Selecting previously unselected package aufs-tools.
Preparing to unpack .../1-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 .../2-cgroupfs-mount_1.4_all.deb ...
Unpacking cgroupfs-mount (1.4) ...
Selecting previously unselected package containerd.io.
Preparing to unpack .../3-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
.../4-docker-ce-cli_5%3a19.03.8~3-0~ubuntu-bionic_amd64.deb ...
Unpacking docker-ce-cli (5:19.03.8~3-0~ubuntu-bionic) ...
Selecting previously unselected package docker-ce.
Preparing to unpack
.../5-docker-ce_5%3a19.03.8~3-0~ubuntu-bionic_amd64.deb ...
Unpacking docker-ce (5:19.03.8~3-0~ubuntu-bionic) ...
Selecting previously unselected package liberror-perl.
Preparing to unpack .../6-liberror-perl_0.17025-1_all.deb ...
Unpacking liberror-perl (0.17025-1) ...
Selecting previously unselected package git-man.
Preparing to unpack .../7-git-man_1%3a2.17.1-1ubuntu0.5_all.deb ...
Unpacking git-man (1:2.17.1-1ubuntu0.5) ...
Selecting previously unselected package git.
Preparing to unpack .../8-git_1%3a2.17.1-1ubuntu0.5_amd64.deb ...
Unpacking git (1:2.17.1-1ubuntu0.5) ...
Setting up aufs-tools (1:4.9+20170918-1ubuntu1) ...
Setting up git-man (1:2.17.1-1ubuntu0.5) ...
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 liberror-perl (0.17025-1) ...
Setting up cgroupfs-mount (1.4) ...
Setting up docker-ce-cli (5:19.03.8~3-0~ubuntu-bionic) ...
Setting up pigz (2.4-1) ...
Setting up git (1:2.17.1-1ubuntu0.5) ...
Setting up docker-ce (5:19.03.8~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.39) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
ureadahead will be reprofiled on next reboot
..

答案1

如果愿意,您可以使用以下安装命令。

apt-get update && apt-get install -y containerd.io=1.2.13-2 docker-ce=5:19.03.11~3-0~ubuntu-$(lsb_release -cs) docker-ce-cli=5:19.03.11~3-0~ubuntu-$(lsb_release -cs)

相关内容