version: "3.9"
services:
# MySQL Container
mysql:
image: mysql:8.0
container_name: mysql
hostname: mysql
volumes:
- type: bind
source: ./mysql_data
target: /var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=mysql_root_password
- MYSQL_DATABASE=glpi_database
- MYSQL_USER=glpi_user
- MYSQL_PASSWORD=glpi_user_password
restart: always
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "glpi_user", "-pglpi_user_password"]
interval: 30s
timeout: 10s
retries: 5
networks:
- glpi_network
# PHP Container
php:
image: php:8.2-apache
container_name: php
hostname: glpi_php8.2_http2.4
ports:
- 1088:80 # 恢复端口映射,将容器内80端口映射到宿主机8088端口,方便访问
volumes:
- type: bind
source: ./glpi_data/glpi
target: /var/www/html/glpi
depends_on:
- mysql
networks:
- glpi_network
environment:
- PHP_EXTENSIONS=curl zip gd intl mbstring # 修改此行,添加所有需要的扩展
# GLPI Container
glpi:
image: diouxx/glpi
container_name: glpi
hostname: glpi_php8.2_http2.4
ports:
- 8088:80 # 恢复端口映射,将容器内80端口映射到宿主机8088端口,方便访问
depends_on:
- mysql
- php
volumes:
- type: bind
source: ./glpi_data/glpi
target: /var/www/html/glpi
- type: bind
source: /etc/localtime
target: /etc/localtime:ro
environment:
- TZ=Asia/Shanghai
networks:
- glpi_network
# phpMyAdmin Container
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
hostname: phpmyadmin
ports:
- 1089:80 # 恢复端口映射,将容器内80端口映射到宿主机1088端口
environment:
- PMA_HOST=mysql
- PMA_USER=glpi_user
- PMA_PASSWORD=glpi_user_password
depends_on:
- mysql
networks:
- glpi_network
networks:
glpi_network:
driver: bridge
ipam:
config:
- subnet: 172.36.0.0/16
构建总是失败,不能运行,群晖自带glpi组件还停好用,飞牛云要自己构建docker容器,compose改了很多次,始终构建不起来,无法搭建服务,求大神不吝赐教,上附compose代码,请教是否有不合理的地方,或者缺失什么配置 |