Answer the question
In order to leave comments, you need to log in
Why is the nginx container not working correctly?
Hello. I have a docker-compose.yml with the following content:
version: '3'
services:
rabbit:
hostname: rabbit
image: rabbitmq:3.6.1-management
environment:
RABBITMQ_DEFAULT_USER: admin
RABBITMQ_DEFAULT_PASS: admin
ports:
- "5672:5672"
- "15672:15672"
healthcheck:
test: [ "CMD", "pwd" ]
timeout: 3s
retries: 20
networks:
- internal
php:
build:
dockerfile: Dockerfile
context: ./
volumes:
- ./:/var/www/html
- ./docker/conf/php/custom.ini:/usr/local/etc/php/conf.d/custom.ini
depends_on:
db:
condition: service_healthy
rabbit:
condition: service_healthy
environment:
XDEBUG_CONFIG: client_host=host.docker.internal
PHP_IDE_CONFIG: "serverName=Docker"
networks:
- internal
db:
image: mysql:latest
environment:
MYSQL_DATABASE: mailing
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: user
MYSQL_PASSWORD: user
healthcheck:
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
timeout: 3s
retries: 20
ports:
- 3306:3306
volumes:
- ./database:/var/lib/mysql
networks:
- internal
nginx:
image: nginx:1.19.2-alpine
ports:
- 8000:80
volumes:
- ./:/var/www/html
- ./docker/conf/nginx:/etc/nginx/conf.d
- ./docker/nginx/logs:/var/log/nginx/
links:
- php
networks:
- internal
depends_on:
db:
condition: service_healthy
networks:
internal:
driver: bridge
ipam:
driver: default
502 Bad Gateway
connect() failed (111: Connection refused) while connecting to upstream, client: 172.23.0.1, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://172.23.0.4:9000", host: "localhost:8000"
Answer the question
In order to leave comments, you need to log in
But if I remove the depends_on section for the php container, then everything works correctly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question