centos安装docker和docker-compose

安装docker 

yum -y install docker

docker 1.13的版本比较旧,新的推荐docker-ce

sudo yum remove docker docker-common docker-selinux docker-engine
sudo yum install docker-ce

验证docker版本

 docker version 
[root@localhost cmd]# docker version
Client: Docker Engine - Community
 Version:           24.0.7
 API version:       1.43
 Go version:        go1.20.10
 Git commit:        afdd53b
 Built:             Thu Oct 26 09:11:35 2023
 OS/Arch:           linux/amd64
 Context:           default
[root@localhost cmd]# docker version
Client: Docker Engine - Community
 Version:           24.0.7
 API version:       1.43
 Go version:        go1.20.10
 Git commit:        afdd53b
 Built:             Thu Oct 26 09:11:35 2023
 OS/Arch:           linux/amd64
 Context:           default

[root@localhost cmd]# docker version
Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-209.git7d71120.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      7d71120/1.13.1
 Built:           Wed Mar  2 15:25:43 2022
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-209.git7d71120.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      7d71120/1.13.1
 Built:           Wed Mar  2 15:25:43 2022
 OS/Arch:         linux/amd64
 Experimental:    false

下载docker-compose,

curl -SL  https://github.com/docker/compose/releases/download/v2.20.2/docker-compose-linux-x86_64  -o /usr/local/bin/docker-compose

没法下载也可以手动下载后copy到/usr/local/bin/目录下。

设置权限:

chmod +x /usr/local/bin/docker-compose

安装完后,可以检查一下版本

docker-compose --version

最后推荐1panel管理你的centos服务器

1Panel 文档在centos8中升级并安装最新版本docker-ce_centos更新docker_only°夏至besos的博客-CSDN博客

你可能感兴趣的:(centos,docker,linux)