CentOS 安装 Docker
基于 CentOS 和 Docker 官方仓库脚本 安装/配置 Docker
文档
说明
- GitLab Runner 执行器可以选择 Docker
- GitLab Pages 运行环境需要 Docker
- 开始使用 Containerd
- Containerd 配置 Docker 加速镜像
- crictl 用户指南
- Containerd hosts 配置
视频演示
安装 Docker
安装 Docker
shell# https://docs.docker.com/engine/install/centos/ # 卸载旧 docker sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine # 安装 docker 仓库 sudo yum install -y yum-utils sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo # 搜索 docker 版本 # yum --showduplicates list docker-ce # 安装 docker sudo yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin sudo systemctl enable docker.service sudo systemctl enable docker.socket systemctl list-unit-files | grep docker sudo systemctl start docker.service sudo systemctl start docker.socket docker info
shellsudo systemctl status docker.service --no-pager
shellsudo systemctl status docker.socket --no-pager
设置 Docker 镜像
shellsudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://hnkfbj7x.mirror.aliyuncs.com"] } EOF
重启 Docker,使配置生效
shellsudo systemctl restart docker.service sudo systemctl restart docker.socket docker info