【Docker】docker-compose安装

前言

  • Docker version 1.13.1, build 7d71120/1.13.1
  • CentOS Linux release 7.9.2009 (Core)

Docker Compose介绍

Docker Compose是一个用来定义和运行复杂应用的Docker工具。

Docker Compose更多介绍

安装方式1:Linux

官方安装说明在这里

  1. 下载Docker Compose:
shell> sudo curl -L --fail \
"https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" \
-o /usr/local/bin/docker-compose
  1. 给docker-compose文件添加执行权限:
shell> sudo chmod +x /usr/local/bin/docker-compose
  1. 将docker-compose(软链接)添加到/usr/bin目录:
shell> sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

注:不一定非要添加到/usr/bin,也可以添加到其它的、属于PATH的目录。

  1. 检查是否安装成功
shell> docker-compose --version
docker-compose version 1.29.2, build 5becea4

安装方式2:PIP

官方安装说明在这里

  1. 安装PIP:
shell> yum install -y python3-pip
  1. 给docker-compose文件添加执行权限:
shell> pip3 install docker-compose
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting docker-compose
  Downloading http://mirrors.tencentyun.com/pypi/packages/f3/3e/ca05e486d44e38eb495ca60b8ca526b192071717387346ed1031ecf78966/docker_compose-1.29.2-py2.py3-none-any.whl (114kB)
...
    100% |████████████████████████████████| 573kB 2.8MB/s 
    Complete output from command python setup.py egg_info:
    
            =============================DEBUG ASSISTANCE==========================
            If you are seeing an error here please try the following to
            successfully install cryptography:
    
            Upgrade to the latest pip and try again. This will fix errors for most
            users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
            =============================DEBUG ASSISTANCE==========================
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-7s6fe6so/cryptography/setup.py", line 14, in <module>
        from setuptools_rust import RustExtension
    ModuleNotFoundError: No module named 'setuptools_rust'
    
    ----------------------------------------
  1. 检查是否安装成功
shell> docker-compose --version
docker-compose version 1.29.2, build 5becea4

安装方式3:容器方式

官方安装说明在这里

  1. 下载脚本:
shell> sudo curl -L --fail \
https://github.com/docker/compose/releases/download/1.29.2/run.sh \
-o /usr/local/bin/docker-compose
  1. 添加执行权限:
shell> sudo chmod +x /usr/local/bin/docker-compose
  1. 检查是否安装成功
shell> docker-compose --version
Unable to find image 'docker/compose:1.29.2' locally
Trying to pull repository docker.io/docker/compose ... 
1.29.2: Pulling from docker.io/docker/compose
339de151aab4: Pull complete 
484a7070e879: Pull complete 
6391cb0e5266: Pull complete 
aaaf585806ed: Pull complete 
Digest: sha256:ae66070588c539b965986dc74e9371e3e62ef71668b72a5eed70de111ed3659e
Status: Downloaded newer image for docker.io/docker/compose:1.29.2
docker-compose version 1.29.2, build 5becea4

镜像

daocloud:https://get.daocloud.io/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值