Linux下安裝Docker-compose的記錄

前言:這段時(shí)間都是在用Vagrant下Centos7學(xué)習(xí)Docker,安裝個(gè)docker-composer也是艱辛不斷。。

Dokcer-compose

先簡(jiǎn)單介紹下,docker-compose是一種Docker官方編排工具,負(fù)責(zé)實(shí)現(xiàn)對(duì)Docker容器集群的快速編排。
定位:定義和運(yùn)行多個(gè)Docker容器的應(yīng)用。

我為什么要使用它,主要是因?yàn)樗軌蚋旖莸木幣盼业娜萜?,且使用yml啟動(dòng)容器非常快捷。(暫時(shí)還沒深入到K8s,大佬勿噴。。)

進(jìn)入正題:

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

image.png

我在執(zhí)行第一條命令,就報(bào)錯(cuò):

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

說我Linux需要更新curl,果斷執(zhí)行更新命令:

yum update -y nss curl libcurl

無奈報(bào)錯(cuò),各種翻閱資料。。
報(bào)錯(cuò)如下:

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=<repoid> ...

     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 <repoid>
        or
            subscription-manager repos --disable=<repoid>

     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=<repoid>.skip_if_unavailable=true

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

研究發(fā)現(xiàn)重點(diǎn)是最后一行 for repository: epel/x86_64. 說明是這個(gè)倉儲(chǔ)出了問題。

解決辦法

把這個(gè)庫刪除

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

這樣執(zhí)行yum命令就可以正確的執(zhí)行。不過少了 epel 倉庫好多軟件包不能用。但是沒關(guān)系,對(duì)于現(xiàn)在的我沒有到那個(gè)需求。

而后再執(zhí)行

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

總算能夠跑通。
最后感謝這個(gè)博主的分享解決我的問題
https://www.lampfree.com/linux/37.html

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 對(duì)大多數(shù)人來說,生活的變化是緩慢的。今天和昨天似乎沒有什么不同;明天也可能和今天一樣。也許人一生僅僅有那么一兩個(gè)輝...
    烏蘭婆拏閱讀 157評(píng)論 0 0
  • 【把你寫進(jìn)書頁里,你在那里,不老不死,不離不傷】 青瓷一出,百年相傳。你說它冰涼,不甚有情。而我卻覺得它正是有情,...
    有理得理閱讀 1,146評(píng)論 0 5
  • 回憶校園生活時(shí),眼前總有躍動(dòng)的身影和結(jié)隊(duì)的學(xué)生。如果選擇描述的詞語,或是“簡(jiǎn)單”,我們的生活固定有序,還有教職員工...
    棲沙洲閱讀 153評(píng)論 0 0

友情鏈接更多精彩內(nèi)容