Ubuntu20.4安装Docker
作者:互联网
1.
sudo apt-get update
2.
sudo apt-get install apt-transport-https ca-certificates software-properties-common curl
3.
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
4.
sudo add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \
$(lsb_release -cs) stable"
5.
sudo apt-get update
6.
sudo apt-get install docker-ce
输入:sudo docker info 查看安装信息
运行测试image hello-world 第一次运行 image 镜像不存在,自动从仓库下载hello-world镜像
sudo docker run hello-world
7.更换镜像仓库为国内服务器
sudo gedit /etc/docker/daemon.json
输入:以下内容 保存
{
"registry-mirrors" : [
"https://registry.docker-cn.com",
"https://docker.mirrors.ustc.edu.cn",
"http://hub-mirror.c.163.com",
"https://cr.console.aliyun.com/"
]
}
systemctl daemon-reload
sudo systemctl restart docker
8.去除 docker sudo 前缀
sudo gpasswd -a ${USER} docker
sudo groupadd docker
sudo chmod a+rwx /var/run/docker.sock
sudo systemctl restart docker
标签:cn,mirrors,sudo,apt,https,docker,Ubuntu20.4,安装,Docker 来源: https://blog.csdn.net/cg_ssh/article/details/118614597