centos8安装docker和docker-compose
1、首先更新一下:yum -y update
2、centos8默认使用podman代替docker,所以需要containerd.io,那我们就安装一下就好了
yum install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.6-3.3.fc30.x86_64.rpm
3、安装一些其他依赖
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum makecache
4、安装docker-ce
dnf -y install docker-ce --nobest
5、开启Docker服务并设置开机自启
systemctl start docker && sudo systemctl enable docker
6、测试,如输出下图结果则安装成功
docker version
Client: Docker Engine - Community
Version: 23.0.3
API version: 1.40 (downgraded from 1.42)
Go version: go1.19.7
Git commit: 3e7cbfd
Built: Tue Apr 4 22:04:21 2023
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 19.03.15
API version: 1.40 (minimum version 1.12)
Go version: go1.13.15
Git commit: 99e3ed8919
Built: Sat Jan 30 03:15:19 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.6
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.0-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.0
GitCommit: fec3683
7、Docker-compose 安装
//推荐方法一# 方法一 (Refer to: https://docs.docker.com/compose/install/)
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# 方法二 (Refer to: https://docs.docker.com/compose/install/#install-using-pip)
sudo pip3 install docker-compose
# 测试, 如输出下图结果则安装成功
docker-compose --version
# 输出:docker-compose version 1.27.4, build xxx
THE END
二维码