在Rocky Linux上安装Docker 更新系统: 登录后复制 sudo dnf update 1. 安装Docker的依赖包: 登录后复制 sudo dnf config-manager --add-repo=https://mirrors.aliyun.com/docker-ce/linux/rhel/docker-ce.repo 1. 安装Docker Engine: 登录后复制 sudo dnf install docker-ce --nobest --allowerasing 1. 启动并设置Docker自动开机启动: 登录后复制 sudo systemctl start docker sudo systemctl enable docker 1.2. 验证Docker是否正确安装: 登录后复制 sudo docker version 1. 登录后复制 Client: Docker Engine - Community Version: 27.1.2 API version: 1.46 Go version: go1.21.13 Git commit: d01f264 Built: Mon Aug 12 11:52:49 2024 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 27.1.2 API version: 1.46 (minimum version 1.24) Go version: go1.21.13 Git commit: f9522e5 Built: Mon Aug 12 11:51:10 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.7.20 GitCommit: 8fc6bcff51318944179630522a095cc9dbf9f353 runc: Version: 1.1.13 GitCommit: v1.1.13-0-g58aa920 docker-init: Version: 0.19.0 GitCommit: de40ad0 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27. 安装docker-compose 1.下载docker-compose 登录后复制 wget https://github.com/docker/compose/releases/download/v2.29.2/docker-compose-linux-x86_64 1. 2.安装 登录后复制 sudo cp docker-compose-linux-x86_64 /usr/local/bin/docker-compose sudo chmod a+x /usr/local/bin/docker-compose 1.2. 3.查看 登录后复制 docker-compose --version 1. 4.将当前用户添加到 docker 组 登录后复制 sudo usermod -aG docker $USER 1. 5.重新登录以使更改生效 增加国内docker镜像 登录后复制 vi /etc/docker/daemon.json 1. 登录后复制 { "registry-mirrors": [ "https://docker.m.daocloud.io", "https://dockerproxy.com", "https://docker.mirrors.ustc.edu.cn", "https://docker.nju.edu.cn" ] } 1.2.3.4.5.6.7.8. 原创作者: u_41084 转载于: https://blog.51cto.com/u_41084/11804375