入门-Docker Compose

Compose是一个定义和运行multi-container Docker应用的一个工具。使用Compose可以通过一个Compose file配置应用的services。使用一个命令就可以创建和运行所有的服务。

使用Compose:

  1. Dockerfile定义app的环境,可以运行在任何地方
  2. Docker-compose.yml定义服务,可以在一个分离的环境中一起运行
  3. 运行docker-compose upCompose将会启动并运行整个app

安装

  • On Linux, you can download the Docker Compose binary from the Compose repository release page on GitHub.
    replacing $dockerComposeVersion with the specific version of Compose you want to use
curl -L https://github.com/docker/compose/releases/download/$dockerComposeVersion/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
  • Apply executable permissions to the binary
sudo chmod +x /usr/local/bin/docker-compose
  • Test the installation
docker-compose --version

你可能感兴趣的:(入门-Docker Compose)