参考文献
Install Docker Engine on Ubuntu
安装Docker
温馨提示:请记得先确认设置好Ubuntu的镜像源
升级
Update the apt package index and install packages to allow apt to use a repository over HTTPS:
代码语言:javascript复制sudo apt-get update
sudo apt-get install
ca-certificates
curl
gnupg
lsb-release
Add Docker’s official GPG key:
代码语言:javascript复制sudo mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
Use the following command to set up the repository:
代码语言:javascript复制echo
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
安装Docker Engine
Update the apt package index:
代码语言:javascript复制sudo apt-get update
Install Docker Engine, containerd, and Docker Compose.
代码语言:javascript复制sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
测试并安装没用的镜像:
代码语言:javascript复制sudo docker run hello-world
添加Docker image的国内镜像 Add registry
全部源添加: 查看是否有这个文件:/etc/docker/daemon.json 没有直接sudo nano新增
代码语言:javascript复制{
"registry-mirrors": [
"https://example.mirror.aliyuncs.com",
"https://hub-mirror.c.163.com",
"https://mirror.baidubce.com"
]
}
之后重新启动服务。
代码语言:javascript复制sudo systemctl daemon-reload
sudo systemctl restart docker
检查加速器是否生效 执行 $ docker info,(如果Docker还未配置用户,则需要用sudo) 如果从结果中看到了如下内容,说明配置成功。
代码语言:javascript复制Registry Mirrors:
https://hub-mirror.c.163.com/
安装portainer
Portainer CE安装