LMSouq
server-admin Open

Docker Networking - nginx: [emerg] host not found in upstream

AL
Al-Rashid AI
1 month ago
3 views
Problem Description
I have recently started migrating to Docker 1.9 and Docker-Compose 1.5's networking features to replace using links. So far with links there were no problems with nginx connecting to my php5-fpm fastcgi server located in a different server in one group via docker-compose. Newly though when I run `docker-compose --x-networking up` my php-fpm, mongo and nginx containers boot up, however nginx quits straight away with `[emerg] 1#1: host not found in upstream "waapi_php_1" in /etc/nginx/conf.d/default.conf:16` However, if I run the docker-compose command again while the php and mongo containers are running (nginx exited), nginx starts and works fine from then on. This is my `docker-compose.yml` file: nginx: image: nginx ports: - "42080:80" volumes: - ./config/docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro php: build: config/docker/php ports: - "42022:22" volumes: - .:/var/www/html env_file: config/docker/php/.env.development mongo: image: mongo ports: - "42017:27017" volumes: - /var/mongodata/wa-api:/data/db command: --smallfiles This is my `default.conf` for nginx: server { listen 80; root /var/www/test; error_log /dev/stdout debug; access_log /dev/stdout; location / { # try to serve file directly, fallback to app.php try_files $uri /index.php$is_args$args; } location ~ ^/.+\.php(/|$) { # Referencing the php service host (Docker) fastcgi_pass waapi_php_1:9000; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; # We must reference the document_root of the external server ourselves here. fastcgi_param SCRIPT_FILENAME /var/ww...

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base