2017-05-31 26 views
2

1週間前まで使用していた作者ファイルです(変更なし)。 docker-compose.ymlファイルにdns: 8.8.8.8を追加して、自宅でもう一度作業しました。ドッカー:アップストリームアプリでホストが見つかりません:9000

これは私がこの問題がDNS関連であったと考えています。

は今(仕事で)別のマシン上でそれを実行しようとしているが、次のエラーが発生します。 nginx: [emerg] host not found in upstream "app:9000" in /etc/nginx/sites-enabled/default.conf:2

私はそれが何を意味するのかわかりません。ここに私のnginxのconfには、次のとおりです。

server { 
    listen 80; 
    listen 443 ssl http2; 

    # Server name being used (exact name, wildcards or regular expression) 
    server_name localhost; 
    client_max_body_size 200M; 

    # Document root, make sure this points to your Phalcon web directory 
    root /var/www/html/public; 
    index index.php index.html; 

    location/{ 
     try_files $uri $uri/ /index.php?_url=$uri&$args; 
    } 

    location ~ \.php$ { 
     fastcgi_pass app:9000; 
     # regex to split $uri to $fastcgi_script_name and $fastcgi_path 
     fastcgi_split_path_info ^(.+\.php)(/.+)$; 
     fastcgi_index index.php; 

     include fastcgi_params; 

     # Bypass the fact that try_files resets $fastcgi_path_info 
     # see: http://trac.nginx.org/nginx/ticket/321 
     set $path_info $fastcgi_path_info; 
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
     fastcgi_param APPLICATION_ENV development; 

     #add_header Authorization $http_authorization; 
    } 

    # Logging 
    error_log /var/log/nginx/error.log; 
    access_log /var/log/nginx/access.log; 
} 

そして、私のドッキングウィンドウ-compose.ymlファイル:

db: 
    image: mysql:latest 
    container_name: dev_db 
    expose: 
    - "3306" 
    ports: 
    - "3307:3306" 
    environment: 
    MYSQL_DATABASE: dbname 
    MYSQL_USER: person 
    MYSQL_PASSWORD: secret 
    MYSQL_ROOT_PASSWORD: secret 
app: 
    image: linxlad/php7-fpm 
    container_name: dev_app 
    tty: true 
    ports: 
    - "6900:6900" 
    volumes: 
    - ./logs/php-fpm:/var/log/php-fpm 
    - ..:/var/www/html 
    links: 
    - db 
web: 
    tty: true 
    image: linxlad/nginx 
    container_name: dev_web 
    ports: 
    - "8080:80" 
    volumes: 
    - ./conf/nginx:/etc/nginx/conf.d 
    - ./logs/nginx:/var/log/nginx 
    - ..:/var/www/html 
    links: 
    - app 

レポがhereです。

誰でも問題を解決する方法を知っていますか?

ありがとうございました

+1

を開始する必要があるコンテナを注文ドッキングウィンドウを伝えるために、ドッキングウィンドウ-compose.ymlファイルにdepends_onセクションを追加する必要があります9000? – Emer

+0

@Emer 9000:9000を変更しようとしました(6900:6900として動作しました)、コンテナを停止して削除しましたが、同じエラーが発生しました:/ – Kal

答えて

4

あなたのアプリの前にnginxのコンテナが入っている可能性があります。あなたは、それはすべきではない、アプリのセクションでポート6900をマッピングしている

https://docs.docker.com/compose/compose-file/#depends_on

web: 
    tty: true 
    image: linxlad/nginx 
    container_name: dev_web 
    ports: 
    - "8080:80" 
    volumes: 
    - ./conf/nginx:/etc/nginx/conf.d 
    - ./logs/nginx:/var/log/nginx 
    - ..:/var/www/html 
    links: 
    - app 
    depends_on: 
    - app 
+0

NB:もし 'version:3 ' "' 'バージョン3は、もはやdepends_onの条件書式をサポートしていない。そのシナリオで何をする必要がありますか? – Kal

+1

私は決して '条件 'フォームのために使用したことがないので、私は分かりません。これはうまくいってうれしい!それは私が以前に実行したものなので、私はそれがあなたのために簡単だろうと思っていた:) –

関連する問題