天天看点

Docker Compose在Centos下的安装与卸载

实践环境

Centos7.8

先决条件

已安装Docker Engine

安装Docker Compose

  1. 运行以下命令下载稳定版本Docker Compose
    $ sudo curl -L "https://github.com/docker/compose/releases/download/1.28.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
          
    实践如下
    # curl -L "https://github.com/docker/compose/releases/download/1.28.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   633  100   633    0     0     38      0  0:00:16  0:00:16 --:--:--   148
    100 11.6M  100 11.6M    0     0  75813      0  0:02:41  0:02:41 --:--:-- 61868
    
          
    注意:要等待下载完成,下载完成后会自动退出命令
  2. 给下载的二进制文件增加可执行权限
    $ sudo chmod +x /usr/local/bin/docker-compose
          
  3. 为方便执行命令,增加软连接
    $ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
          
  4. 测试验证是否安装成功
    $ docker-compose --version
    docker-compose version 1.28.5, build c4eb3a1f
          
    如果软件包没下载完全,执行上述命令时可能报错:
    [110532] Cannot open self /usr/local/bin/docker-compose or archive /usr/local/bin/docker-compose.pkg
          

卸载Docker Compose

$ sudo rm /usr/local/bin/docker-compose
      
$ pip uninstall docker-compose