Linux下安装Docker-compose的记录

前言:这段时间都是在用Vagrant下Centos7学习Docker,安装个docker-composer也是艰辛不断。。

Dokcer-compose

先简单介绍下,docker-compose是一种Docker官方编排工具,负责实现对Docker容器集群的快速编排。
定位:定义和运行多个Docker容器的应用。

我为什么要使用它,主要是因为它能够更快捷的编排我的容器,且使用yml启动容器非常快捷。(暂时还没深入到K8s,大佬勿喷。。)

进入正题:

想安装docker-compose那肯定要到官方文档安装靠谱啦!
地址:https://docs.docker.com/compose/install/

image.png

我在执行第一条命令,就报错:

curl: (35) Peer reports incompatible or unsupported protocol version.

说我Linux需要更新curl,果断执行更新命令:

yum update -y nss curl libcurl

无奈报错,各种翻阅资料。。
报错如下:

yum update
Loaded plugins: fastestmirror
base                                                                                                                                                  | 3.6 kB  00:00:00


 One of the configured repositories failed (Unknown),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo= ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable 
        or
            subscription-manager repos --disable=

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=.skip_if_unavailable=true

Cannot retrieve metalink for repository: epel/x86_64. Please verify its path and try again

研究发现重点是最后一行 for repository: epel/x86_64. 说明是这个仓储出了问题。

解决办法

把这个库删除

rm -f mv /etc/yum.repos.d/epel.repo

这样执行yum命令就可以正确的执行。不过少了 epel 仓库好多软件包不能用。但是没关系,对于现在的我没有到那个需求。

而后再执行

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

总算能够跑通。
最后感谢这个博主的分享解决我的问题
https://www.lampfree.com/linux/37.html

你可能感兴趣的:(Linux下安装Docker-compose的记录)