CentOS 8安装Docker的方法

CentOS 8安装docker,具体步骤:

1.更新yum源

两行命令:

$ sudo sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-*
$ sudo sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*

注:最好安装前先卸载docker旧版本。

2. 移除podman

$ sudo yum erase podman buildah

3.安装docker

$ curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

4.启动docker

$ sudo systemctl start docker

安装完成!


拓展

安装 docker-compose

$ curl -SL https://github.com/docker/compose/releases/download/v2.19.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose version