DockerCompose部署服务(低级)
上篇文章 Docker部署微服务 这种方式非常麻烦,项目一个个package在上传服务器在创建Dockerfile 最后docker build构建镜像,一个个docker run启动。那我们这篇文章简化一部分内容【不用在一个个启动,而通过一个docker-compose配置自启所有容器】
高手请跳过,循循渐进的文章。高手们直接跳过吧
简易介绍DockerCompose
- 目前Hare个人能了概的: 类似‘自动化脚本’,一个个下来编排镜像控制网络。达到一个命令启所有容器效果。
- 官方解释
-
Docker Compose is a tool for defining and running multi-container applications. It is the key to unlocking a streamlined and efficient development and deployment experience.
Compose simplifies the control of your entire application stack, making it easy to manage services, networks, and volumes in a single, comprehensible YAML configuration file. Then, with a single command, you create and start all the services from your configuration file.
Compose works in all environments; production, staging, development, testing, as well as CI workflows. It also has commands for managing the whole lifecycle of your application:
- Start, stop, and rebuild services
- View the status of running services
- Stream the log output of running services
- Run a one-off command on a service
-
DockerCompose安装(Linux)
-
# 下载
curl -SL https://github.com/docker/compose/releases/download/v2.29.6/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose