当前位置:   article > 正文

Ubuntu 22.04 在线安装docker报错E: Package ‘docker-ce‘ has no installation candidate_package 'docker-compose' has no installation candi

package 'docker-compose' has no installation candidate

 

一、报错描述

ubuntu 22.01上执行在线安装docker命令时出现E: Package 'docker-ce' has no installation candidate错误。

sudo apt install docker-ce docker-ce-cli containerd.io

下面是详细报错信息

  1. root@ubuntu:# sudo apt install docker-ce docker-ce-cli containerd.io
  2. Reading package lists... Done
  3. Building dependency tree... Done
  4. Reading state information... Done
  5. Note, selecting 'moby-containerd' instead of 'containerd.io'
  6. Package docker-ce is not available, but is referred to by another package.
  7. This may mean that the package is missing, has been obsoleted, or
  8. is only available from another source
  9. However the following packages replace it:
  10. moby-engine:armhf moby-cli:armhf moby-cli:arm64 moby-engine:arm64 moby-cli moby-engine
  11. Package docker-ce-cli is not available, but is referred to by another package.
  12. This may mean that the package is missing, has been obsoleted, or
  13. is only available from another source
  14. However the following packages replace it:
  15. moby-cli:armhf moby-cli:arm64 moby-cli
  16. E: Package 'docker-ce' has no installation candidate
  17. E: Package 'docker-ce-cli' has no installation candidate
  18. E: Unable to locate package docker-compose-plugin
  19. root@ubuntu:#

二、问题分析

这种报错信息,很明显是说明apt的源设置的不对。

三、解决步骤

安装阿里云证书,并配置阿里云的docker

  1. # 安装阿里云gpg证书
  2. curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add
  3. # 在指定目录下新建docker.list文件,添加阿里云镜像源
  4. cd /etc/apt/sources.list.d
  5. sudo touch docker.list
  6. sudo chmod 666 docker.list
  7. sudo echo "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" > docker.list

修改完成之后需要执行如下命令才会生效

  1. # 更新软件源
  2. sudo apt-get update && sudo apt-get upgrade

重新执行命令安装

  1. # 安装最新Docker
  2. sudo apt install docker-ce docker-ce-cli containerd.io

下面是安装过程

  1. root@ubuntu:/#
  2. root@ubuntu:/# sudo apt install docker-ce docker-ce-cli containerd.io
  3. Reading package lists... Done
  4. Building dependency tree... Done
  5. Reading state information... Done
  6. The following packages were automatically installed and are no longer required:
  7. dotnet-host dotnet-hostfxr-8.0 dotnet-runtime-8.0 dotnet-runtime-deps-8.0
  8. Use 'sudo apt autoremove' to remove them.
  9. The following additional packages will be installed:
  10. docker-buildx-plugin docker-ce-rootless-extras docker-compose-plugin libslirp0 pigz slirp4netns
  11. Suggested packages:
  12. aufs-tools cgroupfs-mount | cgroup-lite
  13. The following NEW packages will be installed:
  14. containerd.io docker-buildx-plugin docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin libslirp0 pigz slirp4netns
  15. 0 upgraded, 9 newly installed, 0 to remove and 4 not upgraded.
  16. Need to get 121 MB/121 MB of archives.
  17. After this operation, 434 MB of additional disk space will be used.
  18. Do you want to continue? [Y/n] Y
  19. Get:1 https://mirrors.aliyun.com/docker-ce/linux/ubuntu jammy/stable amd64 containerd.io amd64 1.6.33-1 [30.0 MB]
  20. Get:2 https://mirrors.aliyun.com/docker-ce/linux/ubuntu jammy/stable amd64 docker-buildx-plugin amd64 0.14.1-1~ubuntu.22.04~jammy [29.6 MB]
  21. Get:3 https://mirrors.aliyun.com/docker-ce/linux/ubuntu jammy/stable amd64 docker-ce-cli amd64 5:26.1.4-1~ubuntu.22.04~jammy [14.6 MB]
  22. Get:4 https://mirrors.aliyun.com/docker-ce/linux/ubuntu jammy/stable amd64 docker-ce amd64 5:26.1.4-1~ubuntu.22.04~jammy [25.3 MB]
  23. Get:5 https://mirrors.aliyun.com/docker-ce/linux/ubuntu jammy/stable amd64 docker-ce-rootless-extras amd64 5:26.1.4-1~ubuntu.22.04~jammy [9,319 kB]
  24. Get:6 https://mirrors.aliyun.com/docker-ce/linux/ubuntu jammy/stable amd64 docker-compose-plugin amd64 2.27.1-1~ubuntu.22.04~jammy [12.5 MB]
  25. Fetched 115 MB in 6min 36s (289 kB/s)
  26. Selecting previously unselected package pigz.
  27. (Reading database ... 117428 files and directories currently installed.)
  28. Preparing to unpack .../0-pigz_2.6-1_amd64.deb ...
  29. Unpacking pigz (2.6-1) ...
  30. Selecting previously unselected package containerd.io.
  31. Preparing to unpack .../1-containerd.io_1.6.33-1_amd64.deb ...
  32. Unpacking containerd.io (1.6.33-1) ...
  33. Selecting previously unselected package docker-buildx-plugin.
  34. Preparing to unpack .../2-docker-buildx-plugin_0.14.1-1~ubuntu.22.04~jammy_amd64.deb ...
  35. Unpacking docker-buildx-plugin (0.14.1-1~ubuntu.22.04~jammy) ...
  36. Selecting previously unselected package docker-ce-cli.
  37. Preparing to unpack .../3-docker-ce-cli_5%3a26.1.4-1~ubuntu.22.04~jammy_amd64.deb ...
  38. Unpacking docker-ce-cli (5:26.1.4-1~ubuntu.22.04~jammy) ...
  39. Selecting previously unselected package docker-ce.
  40. Preparing to unpack .../4-docker-ce_5%3a26.1.4-1~ubuntu.22.04~jammy_amd64.deb ...
  41. Unpacking docker-ce (5:26.1.4-1~ubuntu.22.04~jammy) ...
  42. Selecting previously unselected package docker-ce-rootless-extras.
  43. Preparing to unpack .../5-docker-ce-rootless-extras_5%3a26.1.4-1~ubuntu.22.04~jammy_amd64.deb ...
  44. Unpacking docker-ce-rootless-extras (5:26.1.4-1~ubuntu.22.04~jammy) ...
  45. Selecting previously unselected package docker-compose-plugin.
  46. Preparing to unpack .../6-docker-compose-plugin_2.27.1-1~ubuntu.22.04~jammy_amd64.deb ...
  47. Unpacking docker-compose-plugin (2.27.1-1~ubuntu.22.04~jammy) ...
  48. Selecting previously unselected package libslirp0:amd64.
  49. Preparing to unpack .../7-libslirp0_4.6.1-1build1_amd64.deb ...
  50. Unpacking libslirp0:amd64 (4.6.1-1build1) ...
  51. Selecting previously unselected package slirp4netns.
  52. Preparing to unpack .../8-slirp4netns_1.0.1-2_amd64.deb ...
  53. Unpacking slirp4netns (1.0.1-2) ...
  54. Setting up docker-buildx-plugin (0.14.1-1~ubuntu.22.04~jammy) ...
  55. Setting up containerd.io (1.6.33-1) ...
  56. Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service.
  57. Setting up docker-compose-plugin (2.27.1-1~ubuntu.22.04~jammy) ...
  58. Setting up docker-ce-cli (5:26.1.4-1~ubuntu.22.04~jammy) ...
  59. Setting up libslirp0:amd64 (4.6.1-1build1) ...
  60. Setting up pigz (2.6-1) ...
  61. Setting up docker-ce-rootless-extras (5:26.1.4-1~ubuntu.22.04~jammy) ...
  62. Setting up slirp4netns (1.0.1-2) ...
  63. Setting up docker-ce (5:26.1.4-1~ubuntu.22.04~jammy) ...
  64. Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
  65. Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
  66. Processing triggers for man-db (2.10.2-1) ...
  67. Processing triggers for libc-bin (2.35-0ubuntu3.8) ...

查看docker状态

  1. root@ubuntu:/#
  2. root@ubuntu:/# systemctl status docker
  3. ● docker.service - Docker Application Container Engine
  4. Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
  5. Active: active (running) since Fri 2024-06-14 15:20:50 CST; 5min ago
  6. TriggeredBy: ● docker.socket
  7. Docs: https://docs.docker.com
  8. Main PID: 6832 (dockerd)
  9. Tasks: 9
  10. Memory: 39.8M
  11. CPU: 386ms
  12. CGroup: /system.slice/docker.service
  13. └─6832 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
  14. Jun 14 15:20:45 ubuntu systemd[1]: Starting Docker Application Container Engine...
  15. Jun 14 15:20:45 ubuntu dockerd[6832]: time="2024-06-14T15:20:45.314385132+08:00" level=info msg="Starting up"
  16. Jun 14 15:20:45 ubuntu dockerd[6832]: time="2024-06-14T15:20:45.315541337+08:00" level=info msg="detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/systemd/resolve>
  17. Jun 14 15:20:47 ubuntu dockerd[6832]: time="2024-06-14T15:20:47.272010727+08:00" level=info msg="Loading containers: start."
  18. Jun 14 15:20:49 ubuntu dockerd[6832]: time="2024-06-14T15:20:49.026575396+08:00" level=info msg="Loading containers: done."
  19. Jun 14 15:20:49 ubuntu dockerd[6832]: time="2024-06-14T15:20:49.357911280+08:00" level=info msg="Docker daemon" commit=de5c9cf containerd-snapshotter=false storage-driver=overlay2 version=26.1.4
  20. Jun 14 15:20:49 ubuntu dockerd[6832]: time="2024-06-14T15:20:49.358033280+08:00" level=info msg="Daemon has completed initialization"
  21. Jun 14 15:20:50 ubuntu dockerd[6832]: time="2024-06-14T15:20:50.209184421+08:00" level=info msg="API listen on /run/docker.sock"
  22. Jun 14 15:20:50 ubuntu systemd[1]: Started Docker Application Container Engine.
  23. lines 1-21/21 (END)

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/神奇cpp/article/detail/1004613
推荐阅读
相关标签
  

闽ICP备14008679号