安装 Docker 的 aliyun 源
根据官网的文档,修改为aliyun的镜像源:
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
安装 Docker Engine
安装 Docker Desktop 可跳过这步。
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
配置毫秒镜像。官网:https://1ms.run/
curl -s https://static.1ms.run/1ms-helper/scripts/install.sh | sudo bash /dev/stdin config:mirror
测试是否安装成功。
sudo docker run hello-world
安装 Docker Desktop
根据官网链接下载最新安装包:https://desktop.docker.com/linux/main/amd64/docker-desktop-amd64.deb
sudo apt-get update
sudo apt-get install ./docker-desktop-amd64.deb
Docker 阿里云镜像
到阿里云控制台搜索容器镜像服务
,找到镜像工具 - 镜像加速器
,得到个人镜像地址:https://xxxxxxxx.mirror.aliyuncs.com
。
点击Settings - Docker Engine
加入配置"registry-mirrors": ["https://xxxxxxxx.mirror.aliyuncs.com"]
Docker 使用代理
Docker不能使用系统里设置的代理,必须在Docker里单独设置。点击Settings - Resources - Proxies
。
代理地址设置为http://192.168.80.1:10809
。只能使用HTTP代理
,不能使用PAC代理
,也不能使用SOCKS5代理
(使用SOCK5代理需要订阅Docker)。
Bypass proxy settings for these hosts & domains
(不需要代理的域名)设置为*.aliyuncs.com, localhost, 127.0.0.0/8, ::1
。由于使用了阿里云docker镜像,这里需要把阿里云地址加入不需要代理的域名里。
Docker 安装文档
Ubuntu安装Docker源文档:https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
Ubuntu安装Docker Desktop文档:https://docs.docker.com/desktop/setup/install/linux/ubuntu/
Linux下登录Docker的文档:https://docs.docker.com/desktop/setup/sign-in/#signing-in-with-docker-desktop-for-linux