系统相关
首页 > 系统相关> > Centos7安装docker和docker-compose

Centos7安装docker和docker-compose

作者:互联网

1.设置docker下载源

yum-config-manager \ --add-repo \ https://mirrors.aliyun.com/docker-ce/1inux/centos/docker-ce.repo
sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo
yum makecache fast

2.安装docker

yum install -y docker-ce

3.设置开机自启动

systemctl enable docker

4.启动docker

systemctl start docker

5.下载docker-compose

wget https://github.com/docker/compose/releases/download/1.24.0/docker-compose-Linux-x86_64

6.移动和添加执行权限

mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose

7.创建软链接

ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

8.测试docker和docker-compose

docker --verison
docker-compose version

标签:bin,compose,ce,Centos7,yum,usr,docker
来源: https://www.cnblogs.com/4ykio/p/16501815.html