0


docker-ce 安装与国内源配置 | Ubuntu 20.04

在这里插入图片描述

博客原文

文章目录

让apt可以支持HTTPS

$ aptinstall apt-transport-https ca-certificates curl software-properties-common -y

将官方Docker库的GPG公钥添加到系统中

$ curl-fsSL https://download.docker.com/linux/ubuntu/gpg |sudo apt-key add - 

# 阿里云源curl-fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg |sudo apt-key add -

将Docker库添加到APT里

# 官方源
$ add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"# 阿里源
$ add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal stable"# echo "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal stable" >> /etc/apt/source.list

更新包列表

$ apt update 

为了确保修改生效,让新的安装从Docker库里获取,而不是从Ubuntu自己的库里获取,执行:

$ apt-cache policy docker-ce

安装 docker-ce

$ aptinstall-y docker-ce

配置 docker 阿里源镜像地址

sudomkdir-p /etc/docker
sudotee /etc/docker/daemon.json <<-'EOF'
{
    "registry-mirrors": ["https://nol6uuul.mirror.aliyuncs.com"]
}
EOFsudo systemctl daemon-reload
sudo systemctl restart docker

检查 docker 运行状态

$ systemctl status docker 
● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2024-01-05 16:02:08 CST; 17min ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 241165(dockerd)
      Tasks: 12
     Memory: 29.6M
     CGroup: /system.slice/docker.service
             └─241165 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Jan 05 16:02:08 master1 dockerd[241165]: time="2024-01-05T16:02:08.136300388+08:00"level=info msg="Docker daemon"commit=311b9ff graphdriver=overla>
Jan 05 16:02:08 master1 dockerd[241165]: time="2024-01-05T16:02:08.136351488+08:00"level=info msg="Daemon has completed initialization"
Jan 05 16:02:08 master1 dockerd[241165]: time="2024-01-05T16:02:08.254789219+08:00"level=info msg="API listen on /run/docker.sock"
Jan 05 16:02:08 master1 systemd[1]: Started Docker Application Container Engine.
Jan 05 16:02:46 master1 dockerd[241165]: time="2024-01-05T16:02:46.543587374+08:00"level=warning msg="Error persisting manifest"digest="sha256:2fc>
Jan 05 16:03:38 master1 dockerd[241165]: time="2024-01-05T16:03:38.612170892+08:00" level=info msg="ignoring event" container=6d8d34f0066bde04811038>
Jan 05 16:04:50 master1 dockerd[241165]: time="2024-01-05T16:04:50.406175352+08:00" level=info msg="ignoring event" container=504632135d04b87b5ed83f>
Jan 05 16:05:35 master1 dockerd[241165]: time="2024-01-05T16:05:35.656175212+08:00" level=error msg="Error setting up execcommandin container 5046>
Jan 05 16:09:52 master1 dockerd[241165]: time="2024-01-05T16:09:52.944844810+08:00"level=info msg="Layer sha256:a87ab3c028db3c73f360b49c9dcd171e236>
Jan 05 16:09:52 master1 dockerd[241165]: time="2024-01-05T16:09:52.946428917+08:00" level=info msg="Layer sha256:82ae998286b2bba64ce571578647adcabef>
lines 1-21/21 (END)
标签: docker ubuntu 容器

本文转载自: https://blog.csdn.net/m0_51964671/article/details/135411448
版权归原作者 M·K·T 所有, 如有侵权,请联系我们删除。

“docker-ce 安装与国内源配置 | Ubuntu 20.04”的评论:

还没有评论