工具 就是为懒人服务的 不要怕学习成本 努力学习吧

先说说这个格式 docker-compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
version: '3.8'
services:
nginx:
image: nginx:stable-alpine
restart: always
volumes:
- ./conf:/etc/nginx/conf.d
- /vhost:/vhost
network_mode: host
mariadb:
image: mariadb:10.5.8
volumes:
- ./data:/var/lib/mysql/data
environment:
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
redis:
image: redis:alpine
command: redis-server --requirepass root
ports:
- 6379:6379

version

https://docs.docker.com/compose/compose-file/

  • 此文件适配版本 当然 越新越好

services

  • 服务 要干嘛