OpenEuler安装docker

  • 下载 repo 配置文件

    shell 复制代码
    curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker-ce.repo
  • 修改安装源为国内地址,适用于访问国外网络受限的环境

    shell 复制代码
    sed -i 's#https://download.docker.com#https://mirrors.tuna.tsinghua.edu.cn/docker-ce#' /etc/yum.repos.d/docker-ce.repo
  • Docker 软件源支持的操作系统并不包含 openEuler,openEuler 的使用方式近似 CentOS,因此,修改软件源的配置,使用 centos 7 的软件源

    shell 复制代码
    sed -i 's#$releasever#7#g' /etc/yum.repos.d/docker-ce.repo
  • 清理旧缓存并生成新元数据

    shell 复制代码
    sudo dnf clean all
    sudo dnf makecache
  • 安装 Docker,使用 yum 安装 Docker 时,如果不指定版本,默认会安装当前最新版。

    shell 复制代码
    dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  • 有特殊版本要求的场景,可以指定版本号安装,例如生产环境

    shell 复制代码
    # 查询可用版本
    dnf list docker-ce --showduplicates | sort -r
    
    # 安装指定版本
    dnf install docker-ce-24.0.7 docker-ce-cli-24.0.7 docker-ce-rootless-extras-24.0.7 containerd.io docker-buildx-plugin docker-compose-plugin -y
  • 可选:自定义配置,修改 Docker 配置文件 /etc/docker/daemon.json

    shell 复制代码
    cat > /etc/docker/daemon.json << "EOF"
    {
      "data-root": "/data/docker",
      "registry-mirrors": [
         "https://docker.1ms.run",
        "https://docker.xuanyuan.me"
      ],
      "log-opts": {
        "max-size": "10m",
        "max-file":"3"
      },
      "storage-driver": "overlay2",
      "exec-opts": ["native.cgroupdriver=systemd"]
    }
    
    EOF
    • data-root:数据目录
    • registry-mirrors:常用的 Registry 代理服务器
    • log-opts: Log 文件最容量,默认是 10MB
    • exec-opts: 配置了 cgroup driver 使用 systemd,适用于 Kubernetes 场景,Docker 默认使用 cgroupfs
  • 启动 Docker 服务,并设置开机自启。

    shell 复制代码
    systemctl enable docker --now
  • 查看 Docker 信息

    shell 复制代码
     docker info
    • 验证拉取镜像,构建容器

      shell 复制代码
      docker run hello-world
  • 后续使用 OpenEuler 的 dnf 包管理器,可能会导致出现元数据失败的字眼,在 /etc/yum.repos.d 文件夹下,将CentOS-Base.repo和 docker-ce.repo改个名备份就好。执行完dnf 再改回去

  • 参考文章

  • 参考文章

相关推荐
神奇椰子14 小时前
[特殊字符] 服务器搭建网站完整教程
运维·服务器
慧都小妮子14 小时前
告别看图抓数据:DeviceXPlorer OPC Server 助力数据自动化管理
运维·物联网·自动化·takebishi·dxpserver·opc server
Wpa.wk14 小时前
APP自动化-Appium环境安装
运维·appium·自动化
快乐的哈士奇14 小时前
LangFuse 自托管实战:选型理由、Docker 部署与常用配置全解析
运维·人工智能·docker·容器
数智化管理手记14 小时前
精益生产3步实操,让现场从混乱变标杆
大数据·运维·网络·人工智能·精益工程
志栋智能15 小时前
超自动化巡检:为智能运维(AIOps)铺平道路
运维·安全·自动化
武汉知识图谱科技15 小时前
智慧电厂AI中台:从燃料价值链到设备知识图谱的一体化智能运维
运维·人工智能·知识图谱
墨北小七16 小时前
使用火山引擎 HiAgent 构建工业级设备智能运维智能体
运维·人工智能·火山引擎
Elecard 中国16 小时前
大规模媒体库如何实现自动化 QC?聊聊 VoD 文件检测架构
运维·自动化·ott·视频质检·vod·#视频编码·#音视频技术
weixin_4492900116 小时前
Docker + MySQL 在 Windows 11 上的本地安装部署文档
mysql·docker·容器