123456789101112131415161718192021222324252627282930313233343536 |
- version: '3.8'
- services:
- app:
- image: lcfns:1.0 # 指定已有的应用程序镜像名称和标签
- container_name: lcfns-server
- volumes:
- - lcfns:/go/src/lcfns
- ports:
- - "8889:8889"
- - "8850:8850"
- - "9001:9001"
- environment:
- - DB_HOST=db
- - DB_USER=lc
- - DB_PASSWORD=root
- depends_on:
- - db # 表示 app 依赖于 db,即启动 app 之前会先启动 db
- restart: on-failure
- networks:
- - lcfns-net
- db:
- image: mysql:8 # 指定已有的数据库镜像名称和标签
- container_name: lcfns-mysql
- environment:
- MYSQL_ROOT_PASSWORD: root
- MYSQL_DATABASE: lcfns
- MYSQL_USER: lc
- MYSQL_PASSWORD: root
- ports:
- - "3306:3306" # 将数据库的 3306 端口映射到宿主机的 3306 端口
- networks:
- - lcfns-net
- networks:
- lcfns-net:
- volumes:
- lcfns:
|