Skip to content

Commit a2e8095

Browse files
committed
feat: 为服务加入 hostname
1 parent 980ce9c commit a2e8095

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

docker-compose.yml.example

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ services:
1111
- ${DIR_DATA}/mysql8:/var/lib/mysql
1212
- ${DIR_SERVICES}/mysql/mysql8.cnf:/etc/mysql/conf.d/mysql.cnf
1313
- ${DIR_LOGS}/mysql/8:/var/log/mysql
14+
hostname: mysql8
1415
ports:
1516
- "${MYSQL8_HOST_PORT}:3306"
1617
networks:
@@ -34,6 +35,7 @@ services:
3435
- ${DIR_DATA}/mysql5:/var/lib/mysql
3536
- ${DIR_SERVICES}/mysql/mysql5.cnf:/etc/mysql/conf.d/mysql.cnf
3637
- ${DIR_LOGS}/mysql/5:/var/log/mysql
38+
hostname: mysql5
3739
ports:
3840
- "${MYSQL5_HOST_PORT}:3306"
3941
networks:
@@ -57,6 +59,7 @@ services:
5759
PMA_PASSWORD: ${MYSQL_ROOT_PASSWORD}
5860
volumes:
5961
- ${DIR_SERVICES}/phpmyadmin/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
62+
hostname: phpmyadmin
6063
ports:
6164
- "${PHPMYADMIN_HOST_PORT}:80"
6265
networks:
@@ -75,6 +78,7 @@ services:
7578
volumes:
7679
- ${DIR_DATA}/redis:/data
7780
- ${DIR_SERVICES}/redis/redis.conf:/etc/redis.conf
81+
hostname: redis
7882
ports:
7983
- "${REDIS_HOST_PORT}:6379"
8084
command: ["redis-server", "/etc/redis.conf"]
@@ -93,6 +97,7 @@ services:
9397
TZ: ${TZ}
9498
REDIS_1_HOST: redis
9599
REDIS_1_PORT: 6379
100+
hostname: phpredisadmin
96101
ports:
97102
- "${PHPREDISADMIN_HOST_PORT}:80"
98103
networks:
@@ -108,6 +113,7 @@ services:
108113
image: memcached:${MEMCACHED_VERSION}
109114
environment:
110115
TZ: ${TZ}
116+
hostname: memcached
111117
ports:
112118
- "${MEMCACHED_HOST_PORT}:11211"
113119
command: ["memcached", "-m", "${MEMCACHED_MEMORY}"]
@@ -136,6 +142,7 @@ services:
136142
- ${DIR_LOGS}/php/81/log:/var/log/php
137143
- ${DIR_SOURCE}:/www
138144
working_dir: /www
145+
hostname: php81
139146
cap_add:
140147
- SYS_PTRACE
141148
networks:
@@ -165,6 +172,7 @@ services:
165172
- ${DIR_LOGS}/php/80/log:/var/log/php
166173
- ${DIR_SOURCE}:/www
167174
working_dir: /www
175+
hostname: php80
168176
cap_add:
169177
- SYS_PTRACE
170178
networks:
@@ -192,6 +200,7 @@ services:
192200
- ${DIR_LOGS}/php/74/log:/var/log/php
193201
- ${DIR_SOURCE}:/www
194202
working_dir: /www
203+
hostname: php74
195204
cap_add:
196205
- SYS_PTRACE
197206
networks:
@@ -219,6 +228,7 @@ services:
219228
- ${DIR_LOGS}/php/73/log:/var/log/php
220229
- ${DIR_SOURCE}:/www
221230
working_dir: /www
231+
hostname: php73
222232
cap_add:
223233
- SYS_PTRACE
224234
networks:
@@ -241,6 +251,7 @@ services:
241251
- ${DIR_LOGS}/nginx:/var/log/nginx
242252
- ${DIR_SOURCE}:/www
243253
working_dir: /www
254+
hostname: nginx
244255
ports:
245256
- "${NGINX_HTTP_HOST_PORT}:80"
246257
- "${NGINX_HTTPS_HOST_PORT}:443"
@@ -289,6 +300,7 @@ services:
289300
- ${DIR_DATA}/mongodb:/data/db
290301
- ${DIR_SERVICES}/mongodb/mongod.conf:/etc/mongo/mongod.conf
291302
- ${DIR_LOGS}/mongodb:/var/log/mongodb
303+
hostname: mongodb
292304
ports:
293305
- "${MONGODB_HOST_PORT}:27017"
294306
command: ["--config", "/etc/mongo/mongod.conf"]
@@ -311,6 +323,7 @@ services:
311323
ME_CONFIG_MONGODB_PORT: 27017
312324
volumes:
313325
- /usr/share/zoneinfo:/usr/share/zoneinfo:ro
326+
hostname: mongo-express
314327
ports:
315328
- "${MONGOEXPRESS_HOST_PORT}:8081"
316329
networks:
@@ -352,6 +365,7 @@ services:
352365
I18N_LOCALE: ${kIBANA_I18N_LOCALE}
353366
volumes:
354367
- /usr/share/zoneinfo:/usr/share/zoneinfo:ro
368+
hostname: kibana
355369
ports:
356370
- "${kIBANA_HOST_PORT}:5601"
357371
networks:

0 commit comments

Comments
 (0)