ubuntu安装docker
官网安装地址:
Install Docker Engine on Ubuntu
ubuntu清华大学云源地址:
ubuntu | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
ubuntu 卸载
1.卸载 docker
sudo apt-get remove docker docker-engine docker.io containerd runc
ubuntu 安装
1.更新apt包索引并安装包,以允许apt通过HTTPS使用存储库:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
2.添加Docker的官方GPG密钥:
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
3.使用以下命令设置存储库:
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
4.安装Docker
sudo apt-get update
sudo apt install docker-ce docker-ce-cli containerd.io -y
5设置开机自启并启动
systemctl enable docker --now
6.docker 镜像加速:
阿里云配置地址:
阿里云登录 - 欢迎登录阿里云,安全稳定的云计算服务平台
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://pedp471u.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker