Hax0r
Hax0r

Reputation: 1803

Docker-compose Error

Currently, I have set up 'nginx' and 'php-fpm' using 'docker-compose' like below. Nginx connects to php:9000, however, web server gives me 502 Bad Gateway error. I assume docker-compose command didn't link nginx and php-fpm correctly.

Any advice or suggestion? Thanks in advance.

version: '2'
services:
  nginx:
    container_name: nginx
    image: wb/truckup-nginx:latest # private repo
    #network_mode: 'bridge'
    depends_on:
      - php
    volumes_from:
      - php
    ports:
      - 443:443
      - 80:80
    links:
      - php
  php:
    container_name: php
    ports:
      - 9000:9000
    image: wb/truckup-app:0.1 # private repo
    #environment:
      #MYSQL_HOST: mysql
      #MYSQL_USER: root
      #MYSQL_PASSWORD: passme
      #MYSQL_DATABASE: database
    #데이터 볼륨 컨테이너 안의 데이터 볼륨 디렉터리에 접근가능
    volumes:
      - /home/*:/home/*

Upvotes: 0

Views: 430

Answers (1)

luanbuingoc
luanbuingoc

Reputation: 178

I think your compose-file is correct. To recheck link command run probaly or not. You can exec to your nginx container

docker exec -it nginx bash

and ping to php container using

ping php

if everything is ok, recheck your image.

Upvotes: 2

Related Questions