-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
42 lines (42 loc) · 1.39 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
# yaml 配置
version: '3.2' #下面volumes需要我们版本version是3.2的才能使用
services:
redis: #redis服务的名称,代码中连接时不能使用IP,用这个当域名,如:(Jedis jedis = new Jedis("redis", 6379))
image: "redis:alpine3.18" #这里使用最小镜像的redis镜像
# image: "redis:alpine" # x64
container_name: ginStudy-redis
ports:
- "6379:6379"
mydb:
image: mysql:latest
container_name: mydb
environment:
MYSQL_DATABASE: ginStudy
MYSQL_ROOT_PASSWORD: 123456
TZ: Asia/Shanghai
ports:
- '3306:3306'
# volumes:
# - /app/mysql/db:/var/lib/mysql
# - /app/mysql/conf/my.cnf:/etc/my.cnf
# - /app/mysql/init:/docker-entrypoint-initdb.d
command:
--max_connections=1000
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--default-authentication-plugin=mysql_native_password #解决外部无法访问
web:
container_name: ginStudy-server #有默认的值,但使用了就不能使用横向扩展
build: . #指定Dockerfile的上下文目录为当前目录
depends_on:
- redis
- mydb
ports:
- "8888:80"
links:
- redis:redis
- mydb:mydb
volumes:
- type: bind
source: ~/upload #这个是宿主机的地址
target: /app/upload #这个是容器里配置文件的地址