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

 

版权声明 1. 本网站名称:稻草人笔记   永久网址:https://www.facekun.com
2. 本文链接:centos8安装docker和docker-compose: https://www.facekun.com/arts/665.html
3. 部分文章内容来源于网络,仅作为学习展示之用,版权归原作者所有
4. 因部分文章网络流转次数较多,已无法追溯至原作者,若遗漏导致侵犯了您的权益,请您来信告知我,确认后会尽快删除。
5. 本站禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
6. 如无特别声明本文即为原创文章仅代表个人观点,版权归《稻草人笔记》所有,欢迎转载,转载请保留原文链接。
THE END
分享
二维码
< <上一篇
下一篇>>