欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 养生 > Ubuntu 22.04 在线安装docker报错E: Package ‘docker-ce‘ has no installation candidate

Ubuntu 22.04 在线安装docker报错E: Package ‘docker-ce‘ has no installation candidate

2025/1/19 2:18:51 来源:https://blog.csdn.net/gmaaa123/article/details/139682260  浏览:    关键词:Ubuntu 22.04 在线安装docker报错E: Package ‘docker-ce‘ 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

下面是详细报错信息

root@ubuntu:# sudo apt install docker-ce docker-ce-cli containerd.io
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'moby-containerd' instead of 'containerd.io'
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
However the following packages replace it:moby-engine:armhf moby-cli:armhf moby-cli:arm64 moby-engine:arm64 moby-cli moby-enginePackage docker-ce-cli 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
However the following packages replace it:moby-cli:armhf moby-cli:arm64 moby-cliE: Package 'docker-ce' has no installation candidate
E: Package 'docker-ce-cli' has no installation candidate
E: Unable to locate package docker-compose-plugin
root@ubuntu:#

二、问题分析

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

三、解决步骤

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

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

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

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

重新执行命令安装

# 安装最新Dockersudo apt install docker-ce docker-ce-cli containerd.io

下面是安装过程

root@ubuntu:/# 
root@ubuntu:/# sudo apt install docker-ce docker-ce-cli containerd.io
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:dotnet-host dotnet-hostfxr-8.0 dotnet-runtime-8.0 dotnet-runtime-deps-8.0
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:docker-buildx-plugin docker-ce-rootless-extras docker-compose-plugin libslirp0 pigz slirp4netns
Suggested packages:aufs-tools cgroupfs-mount | cgroup-lite
The following NEW packages will be installed:containerd.io docker-buildx-plugin docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin libslirp0 pigz slirp4netns
0 upgraded, 9 newly installed, 0 to remove and 4 not upgraded.
Need to get 121 MB/121 MB of archives.
After this operation, 434 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 https://mirrors.aliyun.com/docker-ce/linux/ubuntu jammy/stable amd64 containerd.io amd64 1.6.33-1 [30.0 MB]
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]                                                           
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]                                                                
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]                                                                    
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]                                                   
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]                                                          
Fetched 115 MB in 6min 36s (289 kB/s)                                                                                                                                                                 
Selecting previously unselected package pigz.
(Reading database ... 117428 files and directories currently installed.)
Preparing to unpack .../0-pigz_2.6-1_amd64.deb ...
Unpacking pigz (2.6-1) ...
Selecting previously unselected package containerd.io.
Preparing to unpack .../1-containerd.io_1.6.33-1_amd64.deb ...
Unpacking containerd.io (1.6.33-1) ...
Selecting previously unselected package docker-buildx-plugin.
Preparing to unpack .../2-docker-buildx-plugin_0.14.1-1~ubuntu.22.04~jammy_amd64.deb ...
Unpacking docker-buildx-plugin (0.14.1-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package docker-ce-cli.
Preparing to unpack .../3-docker-ce-cli_5%3a26.1.4-1~ubuntu.22.04~jammy_amd64.deb ...
Unpacking docker-ce-cli (5:26.1.4-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package docker-ce.
Preparing to unpack .../4-docker-ce_5%3a26.1.4-1~ubuntu.22.04~jammy_amd64.deb ...
Unpacking docker-ce (5:26.1.4-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package docker-ce-rootless-extras.
Preparing to unpack .../5-docker-ce-rootless-extras_5%3a26.1.4-1~ubuntu.22.04~jammy_amd64.deb ...
Unpacking docker-ce-rootless-extras (5:26.1.4-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package docker-compose-plugin.
Preparing to unpack .../6-docker-compose-plugin_2.27.1-1~ubuntu.22.04~jammy_amd64.deb ...
Unpacking docker-compose-plugin (2.27.1-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package libslirp0:amd64.
Preparing to unpack .../7-libslirp0_4.6.1-1build1_amd64.deb ...
Unpacking libslirp0:amd64 (4.6.1-1build1) ...
Selecting previously unselected package slirp4netns.
Preparing to unpack .../8-slirp4netns_1.0.1-2_amd64.deb ...
Unpacking slirp4netns (1.0.1-2) ...
Setting up docker-buildx-plugin (0.14.1-1~ubuntu.22.04~jammy) ...
Setting up containerd.io (1.6.33-1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service.
Setting up docker-compose-plugin (2.27.1-1~ubuntu.22.04~jammy) ...
Setting up docker-ce-cli (5:26.1.4-1~ubuntu.22.04~jammy) ...
Setting up libslirp0:amd64 (4.6.1-1build1) ...
Setting up pigz (2.6-1) ...
Setting up docker-ce-rootless-extras (5:26.1.4-1~ubuntu.22.04~jammy) ...
Setting up slirp4netns (1.0.1-2) ...
Setting up docker-ce (5:26.1.4-1~ubuntu.22.04~jammy) ...
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 man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.8) ...

查看docker状态

root@ubuntu:/# 
root@ubuntu:/# systemctl status docker
● docker.service - Docker Application Container EngineLoaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)Active: active (running) since Fri 2024-06-14 15:20:50 CST; 5min ago
TriggeredBy: ● docker.socketDocs: https://docs.docker.comMain PID: 6832 (dockerd)Tasks: 9Memory: 39.8MCPU: 386msCGroup: /system.slice/docker.service└─6832 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sockJun 14 15:20:45 ubuntu systemd[1]: Starting Docker Application Container Engine...
Jun 14 15:20:45 ubuntu dockerd[6832]: time="2024-06-14T15:20:45.314385132+08:00" level=info msg="Starting up"
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>
Jun 14 15:20:47 ubuntu dockerd[6832]: time="2024-06-14T15:20:47.272010727+08:00" level=info msg="Loading containers: start."
Jun 14 15:20:49 ubuntu dockerd[6832]: time="2024-06-14T15:20:49.026575396+08:00" level=info msg="Loading containers: done."
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
Jun 14 15:20:49 ubuntu dockerd[6832]: time="2024-06-14T15:20:49.358033280+08:00" level=info msg="Daemon has completed initialization"
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"
Jun 14 15:20:50 ubuntu systemd[1]: Started Docker Application Container Engine.
lines 1-21/21 (END)

 

 

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com