linux的centos系统安装docker

文章目录

  • [一. 安装Docker](#一. 安装Docker)
    • [1. 安装yum-utils包](#1. 安装yum-utils包)
    • [2. 配置Docker yum源](#2. 配置Docker yum源)
    • [3. 安装 Docker CE](#3. 安装 Docker CE)
    • [4. 启动并设置 Docker 开机自启](#4. 启动并设置 Docker 开机自启)
    • [5. 验证Docker安装](#5. 验证Docker安装)
  • [二. 配置镜像加速器](#二. 配置镜像加速器)

一. 安装Docker

1. 安装yum-utils包

shell 复制代码
sudo yum install -y yum-utils

2. 配置Docker yum源

  • 官网源,在没有外网的服务器基本不同,不推荐
shell 复制代码
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
  • 阿里云镜像源,国内强烈推荐
shell 复制代码
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

3. 安装 Docker CE

shell 复制代码
yum install -y docker-ce docker-ce-cli containerd.io

4. 启动并设置 Docker 开机自启

shell 复制代码
sudo systemctl start docker
sudo systemctl enable docker

5. 验证Docker安装

shell 复制代码
docker run hello-world

二. 配置镜像加速器

shell 复制代码
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://kxc88bv4.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
相关推荐
开压路机1 天前
进程控制
linux·服务器
香蕉鼠片1 天前
跨平台开发到底是什么
linux·windows·macos
Eric.Lee20211 天前
docker 启动停止命令
运维·docker·容器
bukeyiwanshui1 天前
20260417 DNS实验
linux
代码中介商1 天前
Linux 帮助手册与用户管理完全指南
linux·运维·服务器
苏渡苇1 天前
5 分钟跑起 Redis(Docker 版)
数据库·redis·缓存·docker·redis入门
weixin_449173651 天前
Linux -- 项目中查找日志的常用Linux命令
linux·运维·服务器
深念Y1 天前
赛米尼M02/海纳斯HiNAS系统-WiFi驱动安装教程
运维·服务器·网络·docker·nas·机顶盒·hinas
想唱rap1 天前
C++智能指针
linux·jvm·数据结构·c++·mysql·ubuntu·bash
Strugglingler1 天前
基于whiptail开发shell导航工具
linux·shell·ui设计·whiptail