docker-Compose
Compose
- 创建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
24
25
26
27
28
29
30
version: '3'
services:
redis:
image: redis
expose:
- 6379
ports:
- "6389:6379"
mysql:
image: mysql:5.5
expose:
- 3306
ports:
- "3307:3306"
environment:
MYSQL_ROOT_PASSWORD: python
MYSQL_USER: root
volumes:
- ./02_mysql:/var/lib/mysql
flask:
build: ./01_flask
volumes:
- ./01_flask/project:/home/project
ports:
- "5000:5000"
depends_on:
- mysql
- redis一些常用的命令
- 生成容器并运行
docker-compose up
- 删除容器
docker-compose down
- 开启容器并运行
docker-compose start
- 停止容器运行
docker-compose stop
depends_on