我尝试使用反向代理运行directus容器。
首先尝试不使用反向代理:它适用于http://my.ip:8585
version: '2'
#
# [ server stack ]
#
services:
mysql:
image: mariadb:latest
container_name: directus-mrdb
restart: always
environment:
- MYSQL_ROOT_PASSWORD=directus
- MYSQL_DATABASE=directus
- MYSQL_USER=directus
- MYSQL_PASSWORD=directus
# If you need to specify a persistent volume for mysql
volumes:
- ./data/db:/var/lib/mysql
directus:
depends_on:
- mysql
image: getdirectus/directus:6.4
container_name: directus
# links:
# - mysql:mysql
ports:
- 8585:8080
restart: always
volumes:
# Switch between named storage, path storage
- ./data/storage:/var/www/html/storage
environment:
- MYSQL_USER=directus
- MYSQL_PASSWORD=directus
- MYSQL_ENV_MYSQL_DATABASE=directus
- MYSQL_PORT_3306_TCP_ADDR=mysql
- MYSQL_PORT_3306_TCP_PORT=3306
- MYSQL_ENV_MYSQL_PASSWORD=directus
- MYSQL_ENV_MYSQL_USER=directus
第二次尝试:我在https://admin.domain.com
上收到网关超时错误version: '2'
#
# [ server stack ]
#
services:
mysql:
image: mariadb:latest
container_name: directus-mrdb
restart: always
environment:
- MYSQL_ROOT_PASSWORD=directus
- MYSQL_DATABASE=directus
- MYSQL_USER=directus
- MYSQL_PASSWORD=directus
# If you need to specify a persistent volume for mysql
volumes:
- ./data/db:/var/lib/mysql
directus:
depends_on:
- mysql
image: getdirectus/directus:6.4
container_name: directus
# links:
# - mysql:mysql
ports:
- 8585:8080
restart: always
volumes:
# Switch between named storage, path storage
- ./data/storage:/var/www/html/storage
environment:
- MYSQL_USER=directus
- MYSQL_PASSWORD=directus
- MYSQL_ENV_MYSQL_DATABASE=directus
- MYSQL_PORT_3306_TCP_ADDR=mysql
- MYSQL_PORT_3306_TCP_PORT=3306
- MYSQL_ENV_MYSQL_PASSWORD=directus
- MYSQL_ENV_MYSQL_USER=directus
labels:
- "traefik.frontend.rule=Host:admin.domain.com"
- "traefik.backend=admin"
- "traefik.port=8585"
- "traefik.frontend.entryPoints=http,https"
- "traefik.enable=true"
- "traefik.docker.network=config_traefik_network"
我理解因为directus容器没有与traefik容器连接。
第三次尝试:我在https://admin.domain.com
上收到错误的网关错误version: '2'
#
# [ server stack ]
#
services:
mysql:
image: mariadb:latest
container_name: directus-mrdb
restart: always
environment:
- MYSQL_ROOT_PASSWORD=directus
- MYSQL_DATABASE=directus
- MYSQL_USER=directus
- MYSQL_PASSWORD=directus
# If you need to specify a persistent volume for mysql
volumes:
- ./data/db:/var/lib/mysql
directus:
depends_on:
- mysql
image: getdirectus/directus:6.4
container_name: directus
# links:
# - mysql:mysql
ports:
- 8585:8080
restart: always
volumes:
# Switch between named storage, path storage
- ./data/storage:/var/www/html/storage
networks:
- config_traefik_network
environment:
- MYSQL_USER=directus
- MYSQL_PASSWORD=directus
- MYSQL_ENV_MYSQL_DATABASE=directus
- MYSQL_PORT_3306_TCP_ADDR=mysql
- MYSQL_PORT_3306_TCP_PORT=3306
- MYSQL_ENV_MYSQL_PASSWORD=directus
- MYSQL_ENV_MYSQL_USER=directus
labels:
- "traefik.frontend.rule=Host:admin.domain.com"
- "traefik.backend=admin"
- "traefik.port=8585"
- "traefik.frontend.entryPoints=http,https"
- "traefik.enable=true"
- "traefik.docker.network=config_traefik_network"
#
# [ networks definition ]
#
networks:
config_traefik_network:
external: true
在这种情况下,我不明白。 容器之间有连接。 后端网址为http://172.18.0.7:8585。证书似乎生成良好。
任何帮助都将受到赞赏。
提前谢谢你。 jB表示