CentOS7 安装 Docker
CentOS7 安装 Docker
1. Docker安装
# 1. 卸载旧版本docker
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
# 2. 安装工具
sudo yum install -y yum-utils
# 3. 设置阿里云yum源仓库
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 4. 更新yum软件包索引
yum makecache fast
# 5. 安装docker
sudo yum install -y docker-ce docker-ce-cli containerd.io
# 6. 启动docker
systemctl start docker
# 7. 设置开机自启
systemctl enable docker
# 8. 查看docker版本
docker -v
2. 配置镜像加速
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": [
"https://elastic.m.daocloud.io",
"https://docker.m.daocloud.io",
"https://gcr.m.daocloud.io",
"https://ghcr.m.daocloud.io",
"https://k8s-gcr.m.daocloud.io",
"https://k8s.m.daocloud.io",
"https://mcr.m.daocloud.io",
"https://nvcr.m.daocloud.io",
"https://quay.m.daocloud.io",
"https://dockerpull.com",
"https://dockerproxy.net"
],
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
3. 安装管理页面
docker run -d -p 8088:9000 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /home/portiner/data:/data portainer/portainer-ce:2.21.0
通过浏览器访问:ip:8088
完成Docker安装
- 感谢你赐予我前进的力量
赞赏者名单
因为你们的支持让我意识到写文章的价值🙏
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 木子李
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果