墙内正确安装docker和docker-compose的方法

安装docker和docker-compose

 

1.卸载旧版本Docker

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

 

2.执行以下命令安装依赖包

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

 

3.鉴于国内网络问题,强烈建议使用国内源执行下面的命令添加 yum 软件源

sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

 

4.安装Docker CE

sudo yum -y install docker-ce

 

5.设置开机启动 Docker CE

sudo systemctl enable docker

sudo systemctl start docker

 

6.鉴于国内网络问题,后续拉取 Docker 镜像十分缓慢,强烈建议安装 Docker 之后配置 国内镜像加速

sudo vi /etc/docker/daemon.json

{

"registry-mirrors": ["https://registry.docker-cn.com"]

}

 

7.重启生效

sudo systemctl daemon-reload

sudo systemctl restart docker

 

8.安装docker-compose 

sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

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

docker-compose --version

sudo curl -L "https://get.daocloud.io/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo curl -L https://get.daocloud.io/docker/compose/releases/download/1.24.0/docker-compose-`uname -s-uname -m` > /usr/local/bin/docker-compose

 

 

 

国内镜像安装 docker-compose

 

按照官网操作

sudo curl -L “https://github.com/docker/compose/releases/download/1.24.0/docker-compose-(uname−s)− (uname -s)-(uname−s)−(uname -m)” -o /usr/local/bin/docker-compose

实在太慢!所以,又去找了一下国内镜像。

国内镜像参考文章:

https://blog.csdn.net/huiyanghu/article/details/82253886

按照以上参考文章抄过来。

curl -L https://get.daocloud.io/docker/compose/releases/download/1.24.0/docker-compose-`uname -s-uname -m` > /usr/local/bin/docker-compose

果然秒达!接下来设置可运行

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

确认一下:

$docker-compose --version

docker-compose version

1.24.0, build 0aa59064

 

 

 

 

posted @ 2020-04-29 15:07  老三的博客  阅读(4175)  评论(1编辑  收藏  举报