在 Linux 系统上安装 Compose

Prerequisites 先决条件

Docker Compose relies on Docker Engine for any meaningful work, so make sure you have Docker Engine installed either locally or remote, depending on your setup.
对于任何有意义的工作,Docker Compose 依赖于 Docker Engine,因此请确保您已经在本地或远程安装了 Docker Engine,这取决于您的设置。

  • On desktop systems like Docker Desktop for Mac and Windows, Docker Compose is included as part of those desktop installs.在桌面系统上,如 Mac 和 Windows 的 Docker Desktop,Docker Compose 作为桌面安装的一部分被包括在内。
  • On Linux systems, first install the Docker Engine for your OS as described on the Get Docker page, then come back here for instructions on installing Compose on Linux systems.在 Linux 系统上,首先按照 Get Docker 页面的描述为您的操作系统安装 Docker Engine,然后回到这里获取在 Linux 系统上安装 Compose 的说明。
  • To run Compose as a non-root user, see Manage Docker as a non-root user.若要作为非根用户运行 Compose,请参见作为非根用户管理 Docker。

Install Compose 安装 Compose

Follow the instructions below to install Compose on Mac, Windows, Windows Server 2016, or Linux systems, or find out about alternatives like using the pip Python package manager or installing Compose as a container.
按照下面的说明在 Mac、 Windows、 Windows Server 2016或 Linux 系统上安装 Compose,或者找到其他替代品,比如使用 pip Python 包管理器或者安装 Compose 作为容器。

**Install a different version **安装不同的版本
The instructions below outline installation of the current stable release (v1.29.2) of Compose. To install a different version of Compose, replace the given release number with the one that you want. For instructions to install Compose 2.0.0 on Linux, see Install Compose 2.0.0 on Linux.
下面的说明概述了 Compose 的当前稳定版本(v1.29.2)的安装。若要安装不同版本的 Compose,请将给定的版本号替换为所需的版本号。有关在 Linux 上安装 Compose 2.0.0的说明,请参阅在 Linux 上安装 Compose 2.0.0。
Compose releases are also listed and available for direct download on the Compose repository release page on GitHub. To install a pre-release of Compose, refer to the install pre-release builds section.
撰写版本也列出来了,可以直接从 GitHub 上的撰写储存库版本页面下载。要安装 Compose 的预发布版本,请参阅安装预发布版本构建部分。

Install Compose on Linux systems 在 Linux 系统上安装 Compose

On Linux, you can download the Docker Compose binary from the Compose repository release page on GitHub. Follow the instructions from the link, which involve running the curl command in your terminal to download the binaries. These step-by-step instructions are also included below.
在 Linux 上,你可以从 GitHub 上的 Compose 库发布页面下载 Docker Compose 二进制文件。
按照链接中的说明进行操作,包括运行 curl 命令
在您的终端下载二进制文件。这些步骤说明是
也包括在下面。

For alpine, the following dependency packages are needed: py-pip, python3-dev, libffi-dev, openssl-dev, gcc, libc-dev, rust, cargo and make.
对于 alpine,需要以下依赖包: py-pip、 python3-dev、 libffi-dev、 openssl-dev、 gcc、 libc-dev、 rust、 cargo 和 make。

  1. Run this command to download the current stable release of Docker Compose:

运行这个命令下载当前的 Docker Compose 稳定版本:

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

**To install a different version of Compose, substitute 1.29.2 with the version of Compose you want to use. For instructions on how to install Compose 2.2.3 on Linux, see **Install Compose 2.0.0 on Linux要安装不同版本的 Compose,请用您想要使用的 Compose 版本替换1.29.2。有关如何使用
在 Linux 上安装 Compose 2.2.3,请参阅 Install
在 Linux 上撰写2.0.0

If you have problems installing with curl, see Alternative Install Options tab above.如果在 curl 上安装有问题,请参阅上面的“可选安装选项”选项卡。

  1. Apply executable permissions to the binary:

对二进制文件应用可执行权限:

sudo chmod +x /usr/local/bin/docker-compose

**Note: **注意:
If the command docker-compose fails after installation, check your path. You can also create a symbolic link to /usr/bin or any other directory in your path.如果 docker-compose 命令在安装后失败,请检查路径。您还可以创建到/usr/bin 或路径中任何其他目录的符号链接。
For example: 例如:
$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

  1. Optionally, install command completion for the bash and zsh shell.

可选地,为 bash 和 zsh shell 安装命令完成。

  1. Test the installation.

测试安装。

docker-compose --version

参考文档
Install Docker Compose

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值