S
S
Shurik2020-04-21 20:36:03
Nginx
Shurik, 2020-04-21 20:36:03

Why won't docker compose nginx start?

Good afternoon. I have a docker-compose.yml (php-nginx-postgresql) that works fine on another machine. But when transferred to another computer, when starting the nginx and php containers, they are turned off after startup. I can't figure out what's wrong.
After running the containers docker-compose up -d browsing running containers produces:

33209d22bb23        nginx               "nginx -g 'daemon of…"   22 minutes ago      Restarting (1) 3 seconds ago                             soap_web_1
d6cded121c54        soap_php            "docker-php-entrypoi…"   22 minutes ago      Restarting (78) 5 seconds ago                            soap_php_1
f3ee2daaff83        postgres:10.1       "docker-entrypoint.s…"   22 minutes ago      Up 22 minutes                   0.0.0.0:5432->5432/tcp   soap_db_1


docker-compose.yml
version: '3'
services:
    web:
        image: nginx
        volumes:
            - ./.docker/conf/nginx/default.conf:/etc/nginx/conf.d/default.conf
            - ./www:/var/www/html
        ports:
            - 80:80
        restart: always
        depends_on:
            - php
            - db
    php:
        build: .docker
        restart: always
        volumes:
            - ./.docker/conf/php/php.ini:/usr/local/etc/php/conf.d/php.ini
            - ./.docker/conf/php/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini
            - ./www:/var/www/html
    composer:
        image: composer
        volumes:
            - .:/app
        command: install
    db:
        image: postgres:10.1
        restart: always
        environment:
            - POSTGRES_DB=${DB_NAME}
            - POSTGRES_USER=${DB_USER}
            - POSTGRES_PASSWORD=${DB_PASSWORD}
        ports:
            - 5432:5432
        volumes:
            - ./.docker/conf/postgres/:/docker-entrypoint-initdb.d/


Dockerfile
FROM php:7.1-fpm

RUN apt-get update && apt-get install -y libxml2-dev \
    && pear install -a SOAP-0.13.0 \
    && docker-php-ext-install soap;

MAINTAINER Descamps Antoine <[email protected]>

RUN apt-get update && apt-get install -y \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
        libpng-dev \
        libicu-dev \
        libpq-dev \
        libxpm-dev \
        libvpx-dev \
    && pecl install xdebug \
    && docker-php-ext-enable xdebug \
    && docker-php-ext-install -j$(nproc) mcrypt \
    && docker-php-ext-install -j$(nproc) gd \
    && docker-php-ext-install -j$(nproc) intl \
    && docker-php-ext-install -j$(nproc) zip \
    && docker-php-ext-install -j$(nproc) pgsql \
    && docker-php-ext-install -j$(nproc) pdo_pgsql \
    && docker-php-ext-install -j$(nproc) exif \
    && docker-php-ext-configure gd \
        --with-freetype-dir=/usr/include/ \
        --with-jpeg-dir=/usr/include/ \
        --with-xpm-dir=/usr/lib/x86_64-linux-gnu/ \
        --with-vpx-dir=/usr/lib/x86_64-linux-gnu/ \


nginx default.conf
# Nginx configuration

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name localhost;

    root /var/www/html;

    location / {
        # try to serve file directly, fallback to index.php
        try_files $uri /index.php$is_args$args;
    }

    #location ~ ^/index\.php(/|$) {
    location ~ ^/[^/]+\.php(/|$) {
        fastcgi_pass php:9000;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;

        # optionally set the value of the environment variables used in the application
        # fastcgi_param APP_ENV prod;
        # fastcgi_param APP_SECRET <app-secret-id>;
        # fastcgi_param DATABASE_URL "mysql://db_user:[email protected]:3306/db_name";

        # When you are using symlinks to link the document root to the
        # current version of your application, you should pass the real
        # application path instead of the path to the symlink to PHP
        # FPM.
        # Otherwise, PHP's OPcache may not properly detect changes to
        # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
        # for more information).
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        # Prevents URIs that include the front controller. This will 404:
        # http://domain.tld/index.php/some-path
        # Remove the internal directive to allow URIs like this
        #internal;
    }

    # return 404 for all other php files not matching the front controller
    # this prevents access to other php files you don't want to be accessible.
    location ~ \.php$ {
        return 404;
    }

    error_log /var/log/nginx/project_error.log;
    access_log /var/log/nginx/project_access.log;
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Kuts, 2020-04-21
@fox_12

docker  logs  soap_web_1
docker  logs soap_php

what do they give out?
the fastest ports that your containers are trying to bind to are already occupied in the system

S
Shurik, 2020-04-21
@svisch

part of the output:

php_1       | [21-Apr-2020 17:10:43] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_openssl.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_openssl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:43] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_curl.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:43] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_xmlrpc.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_xmlrpc.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:43] ERROR: failed to create new listening socket: socket(): Address family not supported by protocol (97)
php_1       | [21-Apr-2020 17:10:43] ERROR: failed to create new listening socket: socket(): Address family not supported by protocol (97)
php_1       | [21-Apr-2020 17:10:43] ERROR: FPM initialization failed
php_1       | [21-Apr-2020 17:10:43] ERROR: FPM initialization failed
php_1       | [21-Apr-2020 17:10:44] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_openssl.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_openssl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:44] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_curl.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:44] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_xmlrpc.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_xmlrpc.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:44] ERROR: failed to create new listening socket: socket(): Address family not supported by protocol (97)
php_1       | [21-Apr-2020 17:10:44] ERROR: failed to create new listening socket: socket(): Address family not supported by protocol (97)
php_1       | [21-Apr-2020 17:10:44] ERROR: FPM initialization failed
php_1       | [21-Apr-2020 17:10:44] ERROR: FPM initialization failed
php_1       | [21-Apr-2020 17:10:45] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_openssl.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_openssl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:45] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_curl.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:45] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_xmlrpc.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_xmlrpc.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:45] ERROR: failed to create new listening socket: socket(): Address family not supported by protocol (97)
php_1       | [21-Apr-2020 17:10:45] ERROR: failed to create new listening socket: socket(): Address family not supported by protocol (97)
php_1       | [21-Apr-2020 17:10:45] ERROR: FPM initialization failed
php_1       | [21-Apr-2020 17:10:45] ERROR: FPM initialization failed
php_1       | [21-Apr-2020 17:10:47] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_openssl.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_openssl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:47] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_curl.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:47] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_xmlrpc.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_xmlrpc.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:47] ERROR: failed to create new listening socket: socket(): Address family not supported by protocol (97)
php_1       | [21-Apr-2020 17:10:47] ERROR: failed to create new listening socket: socket(): Address family not supported by protocol (97)
php_1       | [21-Apr-2020 17:10:47] ERROR: FPM initialization failed
php_1       | [21-Apr-2020 17:10:47] ERROR: FPM initialization failed
php_1       | [21-Apr-2020 17:10:48] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_openssl.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_openssl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:48] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_curl.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:48] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_xmlrpc.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_xmlrpc.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:48] ERROR: failed to create new listening socket: socket(): Address family not supported by protocol (97)
php_1       | [21-Apr-2020 17:10:48] ERROR: failed to create new listening socket: socket(): Address family not supported by protocol (97)
php_1       | [21-Apr-2020 17:10:48] ERROR: FPM initialization failed
php_1       | [21-Apr-2020 17:10:48] ERROR: FPM initialization failed
php_1       | [21-Apr-2020 17:10:51] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_openssl.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_openssl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:51] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_curl.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:51] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_xmlrpc.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/php_xmlrpc.dll: cannot open shared object file: No such file or directory in Unknown on line 0
php_1       | [21-Apr-2020 17:10:51] ERROR: failed to create new listening socket: socket(): Address family not supported by protocol (97)
php_1       | [21-Apr-2020 17:10:51] ERROR: failed to create new listening socket: socket(): Address family not supported by protocol (97)
php_1       | [21-Apr-2020 17:10:51] ERROR: FPM initialization failed
php_1       | [21-Apr-2020 17:10:51] ERROR: FPM initialization failed
...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question