美文网首页Docker 基础
Docker 进阶 (二) yaml 编写规则

Docker 进阶 (二) yaml 编写规则

作者: yjtuuige | 来源:发表于2021-07-10 17:24 被阅读0次

官方介绍

  • docker-compose.yml 核心所在
# 三层
version: "3.9" # 第一层:版本
services: # 第二层:服务
   web:
       images:
       bulid:
       ports:
       network:
       ...
   redis:
       ...
   mysql:
       ...
    # 第三层 其他配置 网络、数据卷、全局配置
networks:
   frontend:
   backend:
volumes:
   db-data:
configs:
  • 启动顺序
version: "3.9"
services:
  web:
    build: .    # 第三步
    depends_on:
      - db
      - redis
  redis:    # 第二步
    image: redis
  db:    # 第一步
    image: postgres

相关文章

网友评论

    本文标题:Docker 进阶 (二) yaml 编写规则

    本文链接:https://www.haomeiwen.com/subject/zymcpltx.html