Skip to main content

RockyLinux9

静态IP

安装Docker

  1. 安装之前卸载删除之前的Docker
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine \
podman \
runc

rm -rf /var/lib/docker/
  1. 设置存储库
sudo yum install -y yum-utils
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo

!如果按照官方教程使用yum安装了, 使用sed命令删除


sed -i -e 's/baseurl=https:\/\/download\.docker\.com\/linux\/\(fedora\|rhel\)\/$releasever/baseurl\=https:\/\/download.docker.com\/linux\/centos\/$releasever/g' /etc/yum.repos.d/docker-ce.repo
  1. 安装Docker
sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  1. 启动Docker
sudo systemctl start docker
  1. 通过运行 hello-world 映像来验证 Docker 引擎安装是否成功。
sudo docker run hello-world
  1. 优化设置
sudo systemctl enable docker