Linux下安装Docker-compose的记录

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

Dokcer-compose

先简单介绍下,docker-compose是一种Docker官方编排工具,负责实现对Docker容器集群的快速编排。
定位:定义和运行多F x Q m { 5 )个DockeE r g ? 0 f Zr容器的应用。

我为什么要使# m V M x R用它,主要是因为它能够更快捷的编排l . 8 ! N U 6我的容器,且使用yml启动容器非常快捷。(暂时还没深入到K8s,大佬勿喷。。)

进入正题:

想安装docke0 4 : U Q E -r-compose那肯定要到官方文档I { Y k D安装靠谱啦!
地址:https://docs.docker.com/compose/install/

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

curl: (35) Pee7 l 7 er reports incompatible or unsui w K * 2 @pported 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)k c o,
and yum doesnd G c R O _ 7 |'t have enough cached data to continue. Atq  a @ 0 | G F this point the only! t 9
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contac/ ~ i e 8 Y C ct the upstream for the r2 H C , * 8 t )epu E m t A q Y /ository and get them to fix the problem.8 g U | ~ T A X Z
2. Reconfigure thR ; 2 6e baseurl/etA , Xc. for the repository, to point to a worD O t n T V @king
upstream. This is most often useful if you are using a newer
distribution release than is supported by3 : * th$ | l fe repository (and the
packages for the previous distribution release still work).
3. Run tU 8 V V _ :he command with the repository temporarily disabled
yum --diY % l E Ssablerepo=<repoid> ...
4. Disa3 j /ble the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanenr )  J ptly enable it
again or use --enablerepo for temporary us Y v ? 0 w 4 ?s? # d Kage:
yum-config-manager --disablV n } 1 a w Ce <repoid>
or
subscription-manager res ] d E % D 7 J Bpos --disable=<repoid&gT ( + ( Mt;
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yuE N )m 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 tempoh 0 ] | y * 7 @ arard h Vy proble^ # I | J D mm though, this is often a nice
compromise:
yum-config-manager --save --setopt=<repoid>.sf ^ Z Ckip_if_unavailable=true
Cannot retrieve metalink fJ h H c q y i Dor repository: epel/x86_64. Please verifj t 7 o L (y its path and try again

研究发现重点是最c I * Z N后一行 for repoj I ; ) y ` % |sitory: epel/x86_64. 说明是这个仓储出了问题。

解决办法

把这个库删除

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

这样执T p i f $ = f行yum命令就可以正确的执行~ N _ c m。不过少了 epel 仓库好多软件包不l 8 D ! g能用. K K 5 V m ]。但是没关系,对于现在的我没有到那个c C R b l 6 T e需求。

而后再执行

curl -L "https:B + % ` 0 s V [ 2//github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

总算能够跑通。
最后感谢M R 4 ^这个博主的r 4 K + ^ | H D分享解决我的问题
https://www.lampfree.com/linux/37.html