Docker разрешает службу NGINX с помощью docker NGINX

#docker #nginx #laradock

Вопрос:

После установки Docker на сервер и. LaraDock я пытаюсь использовать докеризованный Laravel проект, так как я установил nginx его на сервер, на laradock котором он тоже есть, а затем при запуске проекта я получаю эту ошибку:

 Recreating laradock_nginx_1 ... error

ERROR: for laradock_nginx_1  Cannot start service nginx: driver failed programming external connectivity on endpoint laradock_nginx_1 (0fa283c2e82aa1ccf59d3ccfbf2d25f44e17239e1ad74f3471c1f964d87884d1): Error starting userland proxy: listen tcp4 0.0.0.0:443: bind: address already in use
 

Я новичок Docker и не знаю, как я могу решить эту проблему. я устал менять nginx http хоста и порт на 8080, как в этой строке

 NGINX_HOST_HTTP_PORT=80
 

но это не решит мою проблему

nginx конфигурация по умолчанию:

 server {

    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    # For https
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server ipv6only=on;
    # ssl_certificate /etc/nginx/ssl/default.crt;
    # ssl_certificate_key /etc/nginx/ssl/default.key;

    server_name localhost;
    root /var/www/public;
    index index.php index.html index.htm;

    location / {
         try_files $uri $uri/ /index.php$is_args$args;
    }

    location ~ .php$ {
        try_files $uri /index.php =404;
        fastcgi_pass php-upstream;
        fastcgi_index index.php;
        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        #fixes timeouts
        fastcgi_read_timeout 600;
        include fastcgi_params;
    }

    location ~ /.ht {
        deny all;
    }

    location /.well-known/acme-challenge/ {
        root /var/www/letsencrypt/;
        log_not_found off;
    }
}
 

nginx Докерфайл:

 FROM nginx:alpine

LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"

COPY nginx.conf /etc/nginx/

# If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env.

ARG CHANGE_SOURCE=false
RUN if [ ${CHANGE_SOURCE} = true ]; then 
    # Change application source from dl-cdn.alpinelinux.org to aliyun source
    sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories 
;fi

RUN apk update 
    amp;amp; apk upgrade 
    amp;amp; apk --update add logrotate 
    amp;amp; apk add --no-cache openssl 
    amp;amp; apk add --no-cache bash

RUN apk add --no-cache curl

RUN set -x ; 
    addgroup -g 82 -S www-data ; 
    adduser -u 82 -D -S -G www-data www-data amp;amp; exit 0 ; exit 1

ARG PHP_UPSTREAM_CONTAINER=php-fpm
ARG PHP_UPSTREAM_PORT=9000

# Create 'messages' file used from 'logrotate'
RUN touch /var/log/messages

# Copy 'logrotate' config file
COPY logrotate/nginx /etc/logrotate.d/

# Set upstream conf and remove the default conf
RUN echo "upstream php-upstream { server ${PHP_UPSTREAM_CONTAINER}:${PHP_UPSTREAM_PORT}; }" > /etc/nginx/conf.d/upstream.conf 
    amp;amp; rm /etc/nginx/conf.d/default.conf

ADD ./startup.sh /opt/startup.sh
RUN sed -i 's/r//g' /opt/startup.sh
CMD ["/bin/bash", "/opt/startup.sh"]

EXPOSE 80 81 443
 

я не могу отключить сервер nginx , и не могли бы вы, пожалуйста, как я могу решить эту проблему?

обновленный:

docker-compose.yml

 version: '3.5'

networks:
  frontend:
    driver: ${NETWORKS_DRIVER}
  backend:
    driver: ${NETWORKS_DRIVER}

volumes:
  redis:
    driver: ${VOLUMES_DRIVER}
  mariadb:
    driver: ${VOLUMES_DRIVER}
  mongo:
    driver: ${VOLUMES_DRIVER}
  phpmyadmin:
    driver: ${VOLUMES_DRIVER}
  docker-in-docker:
    driver: ${VOLUMES_DRIVER}
services:

### Workspace Utilities ##################################
    workspace:
      build:
        context: ./workspace
        args:
          - CHANGE_SOURCE=${CHANGE_SOURCE}
          - SHELL_OH_MY_ZSH=${SHELL_OH_MY_ZSH}
          - SHELL_OH_MY_ZSH_AUTOSUGESTIONS=${SHELL_OH_MY_ZSH_AUTOSUGESTIONS}
          - SHELL_OH_MY_ZSH_ALIASES=${SHELL_OH_MY_ZSH_ALIASES}
          - UBUNTU_SOURCE=${UBUNTU_SOURCE}
          - BASE_IMAGE_TAG_PREFIX=${WORKSPACE_BASE_IMAGE_TAG_PREFIX}
          - LARADOCK_PHP_VERSION=${PHP_VERSION}
          - LARADOCK_PHALCON_VERSION=${PHALCON_VERSION}
          - INSTALL_SUBVERSION=${WORKSPACE_INSTALL_SUBVERSION}
          - INSTALL_BZ2=${WORKSPACE_INSTALL_BZ2}
          - INSTALL_GMP=${WORKSPACE_INSTALL_GMP}
          - INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG}
          - INSTALL_PCOV=${WORKSPACE_INSTALL_PCOV}
          - INSTALL_PHPDBG=${WORKSPACE_INSTALL_PHPDBG}
          - INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE}
          - INSTALL_SSH2=${WORKSPACE_INSTALL_SSH2}
          - INSTALL_SOAP=${WORKSPACE_INSTALL_SOAP}
          - INSTALL_XSL=${WORKSPACE_INSTALL_XSL}
          - INSTALL_LDAP=${WORKSPACE_INSTALL_LDAP}
          - INSTALL_SMB=${WORKSPACE_INSTALL_SMB}
          - INSTALL_IMAP=${WORKSPACE_INSTALL_IMAP}
          - INSTALL_MONGO=${WORKSPACE_INSTALL_MONGO}
          - INSTALL_AMQP=${WORKSPACE_INSTALL_AMQP}
          - INSTALL_CASSANDRA=${WORKSPACE_INSTALL_CASSANDRA}
          - INSTALL_GEARMAN=${WORKSPACE_INSTALL_GEARMAN}
          - INSTALL_PHPREDIS=${WORKSPACE_INSTALL_PHPREDIS}
          - INSTALL_MSSQL=${WORKSPACE_INSTALL_MSSQL}
          - NVM_NODEJS_ORG_MIRROR=${WORKSPACE_NVM_NODEJS_ORG_MIRROR}
          - INSTALL_NODE=${WORKSPACE_INSTALL_NODE}
          - NPM_REGISTRY=${WORKSPACE_NPM_REGISTRY}
          - NPM_FETCH_RETRIES=${WORKSPACE_NPM_FETCH_RETRIES}
          - NPM_FETCH_RETRY_FACTOR=${WORKSPACE_NPM_FETCH_RETRY_FACTOR}
          - NPM_FETCH_RETRY_MINTIMEOUT=${WORKSPACE_NPM_FETCH_RETRY_MINTIMEOUT}
          - NPM_FETCH_RETRY_MAXTIMEOUT=${WORKSPACE_NPM_FETCH_RETRY_MAXTIMEOUT}
          - INSTALL_PNPM=${WORKSPACE_INSTALL_PNPM}
          - INSTALL_YARN=${WORKSPACE_INSTALL_YARN}
          - INSTALL_NPM_GULP=${WORKSPACE_INSTALL_NPM_GULP}
          - INSTALL_NPM_BOWER=${WORKSPACE_INSTALL_NPM_BOWER}
          - INSTALL_NPM_VUE_CLI=${WORKSPACE_INSTALL_NPM_VUE_CLI}
          - INSTALL_NPM_ANGULAR_CLI=${WORKSPACE_INSTALL_NPM_ANGULAR_CLI}
          - INSTALL_DRUSH=${WORKSPACE_INSTALL_DRUSH}
          - INSTALL_WP_CLI=${WORKSPACE_INSTALL_WP_CLI}
          - INSTALL_DRUPAL_CONSOLE=${WORKSPACE_INSTALL_DRUPAL_CONSOLE}
          - INSTALL_AEROSPIKE=${WORKSPACE_INSTALL_AEROSPIKE}
          - INSTALL_OCI8=${WORKSPACE_INSTALL_OCI8}
          - INSTALL_V8JS=${WORKSPACE_INSTALL_V8JS}
          - COMPOSER_GLOBAL_INSTALL=${WORKSPACE_COMPOSER_GLOBAL_INSTALL}
          - COMPOSER_VERSION=${WORKSPACE_COMPOSER_VERSION}
          - COMPOSER_AUTH=${WORKSPACE_COMPOSER_AUTH}
          - COMPOSER_REPO_PACKAGIST=${WORKSPACE_COMPOSER_REPO_PACKAGIST}
          - INSTALL_WORKSPACE_SSH=${WORKSPACE_INSTALL_WORKSPACE_SSH}
          - INSTALL_LARAVEL_ENVOY=${WORKSPACE_INSTALL_LARAVEL_ENVOY}
          - INSTALL_LARAVEL_INSTALLER=${WORKSPACE_INSTALL_LARAVEL_INSTALLER}
          - INSTALL_DEPLOYER=${WORKSPACE_INSTALL_DEPLOYER}
          - INSTALL_PRESTISSIMO=${WORKSPACE_INSTALL_PRESTISSIMO}
          - INSTALL_LINUXBREW=${WORKSPACE_INSTALL_LINUXBREW}
          - INSTALL_MC=${WORKSPACE_INSTALL_MC}
          - INSTALL_SYMFONY=${WORKSPACE_INSTALL_SYMFONY}
          - INSTALL_PYTHON=${WORKSPACE_INSTALL_PYTHON}
          - INSTALL_PYTHON3=${WORKSPACE_INSTALL_PYTHON3}
          - INSTALL_IMAGE_OPTIMIZERS=${WORKSPACE_INSTALL_IMAGE_OPTIMIZERS}
          - INSTALL_IMAGEMAGICK=${WORKSPACE_INSTALL_IMAGEMAGICK}
          - INSTALL_TERRAFORM=${WORKSPACE_INSTALL_TERRAFORM}
          - INSTALL_DUSK_DEPS=${WORKSPACE_INSTALL_DUSK_DEPS}
          - INSTALL_PG_CLIENT=${WORKSPACE_INSTALL_PG_CLIENT}
          - INSTALL_PHALCON=${WORKSPACE_INSTALL_PHALCON}
          - INSTALL_SWOOLE=${WORKSPACE_INSTALL_SWOOLE}
          - INSTALL_TAINT=${WORKSPACE_INSTALL_TAINT}
          - INSTALL_LIBPNG=${WORKSPACE_INSTALL_LIBPNG}
          - INSTALL_GRAPHVIZ=${WORKSPACE_INSTALL_GRAPHVIZ}
          - INSTALL_IONCUBE=${WORKSPACE_INSTALL_IONCUBE}
          - INSTALL_MYSQL_CLIENT=${WORKSPACE_INSTALL_MYSQL_CLIENT}
          - INSTALL_PING=${WORKSPACE_INSTALL_PING}
          - INSTALL_SSHPASS=${WORKSPACE_INSTALL_SSHPASS}
          - INSTALL_INOTIFY=${WORKSPACE_INSTALL_INOTIFY}
          - INSTALL_FSWATCH=${WORKSPACE_INSTALL_FSWATCH}
          - INSTALL_AST=${WORKSPACE_INSTALL_AST}
          - INSTALL_YAML=${WORKSPACE_INSTALL_YAML}
          - INSTALL_RDKAFKA=${WORKSPACE_INSTALL_RDKAFKA}
          - INSTALL_MAILPARSE=${WORKSPACE_INSTALL_MAILPARSE}
          - INSTALL_GIT_PROMPT=${WORKSPACE_INSTALL_GIT_PROMPT}
          - INSTALL_XMLRPC=${WORKSPACE_INSTALL_XMLRPC}
          - PUID=${WORKSPACE_PUID}
          - PGID=${WORKSPACE_PGID}
          - CHROME_DRIVER_VERSION=${WORKSPACE_CHROME_DRIVER_VERSION}
          - NODE_VERSION=${WORKSPACE_NODE_VERSION}
          - YARN_VERSION=${WORKSPACE_YARN_VERSION}
          - DRUSH_VERSION=${WORKSPACE_DRUSH_VERSION}
          - AST_VERSION=${WORKSPACE_AST_VERSION}
          - IMAGEMAGICK_VERSION=${WORKSPACE_IMAGEMAGICK_VERSION}
          - TZ=${WORKSPACE_TIMEZONE}
          - BLACKFIRE_CLIENT_ID=${BLACKFIRE_CLIENT_ID}
          - BLACKFIRE_CLIENT_TOKEN=${BLACKFIRE_CLIENT_TOKEN}
          - INSTALL_POWERLINE=${WORKSPACE_INSTALL_POWERLINE}
          - INSTALL_SUPERVISOR=${WORKSPACE_INSTALL_SUPERVISOR}
          - INSTALL_FFMPEG=${WORKSPACE_INSTALL_FFMPEG}
          - INSTALL_AUDIOWAVEFORM=${WORKSPACE_INSTALL_AUDIOWAVEFORM}
          - INSTALL_WKHTMLTOPDF=${WORKSPACE_INSTALL_WKHTMLTOPDF}
          - INSTALL_GNU_PARALLEL=${WORKSPACE_INSTALL_GNU_PARALLEL}
          - INSTALL_LNAV=${WORKSPACE_INSTALL_LNAV}
          - INSTALL_PROTOC=${WORKSPACE_INSTALL_PROTOC}
          - PROTOC_VERSION=${WORKSPACE_PROTOC_VERSION}
          - INSTALL_DOCKER_CLIENT=${WORKSPACE_INSTALL_DOCKER_CLIENT}
          - http_proxy
          - https_proxy
          - no_proxy
      volumes:
        - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}${APP_CODE_CONTAINER_FLAG}
        - docker-in-docker:/certs/client
        - ./php-worker/supervisord.d:/etc/supervisord.d
      extra_hosts:
        - "dockerhost:${DOCKER_HOST_IP}"
      ports:
        - "${WORKSPACE_SSH_PORT}:22"
        - "${WORKSPACE_BROWSERSYNC_HOST_PORT}:3000"
        - "${WORKSPACE_BROWSERSYNC_UI_HOST_PORT}:3001"
        - "${WORKSPACE_VUE_CLI_SERVE_HOST_PORT}:8080"
        - "${WORKSPACE_VUE_CLI_UI_HOST_PORT}:8000"
        - "${WORKSPACE_ANGULAR_CLI_SERVE_HOST_PORT}:4200"
      tty: true
      environment:
        - PHP_IDE_CONFIG=${PHP_IDE_CONFIG}
        - DOCKER_HOST=tcp://docker-in-docker:2376
        - DOCKER_TLS_VERIFY=1
        - DOCKER_TLS_CERTDIR=/certs
        - DOCKER_CERT_PATH=/certs/client
      networks:
        - frontend
        - backend
      links:
        - docker-in-docker

### PHP-FPM ##############################################
    php-fpm:
      build:
        context: ./php-fpm
        args:
          - CHANGE_SOURCE=${CHANGE_SOURCE}
          - BASE_IMAGE_TAG_PREFIX=${PHP_FPM_BASE_IMAGE_TAG_PREFIX}
          - LARADOCK_PHP_VERSION=${PHP_VERSION}
          - LARADOCK_PHALCON_VERSION=${PHALCON_VERSION}
          - INSTALL_BZ2=${PHP_FPM_INSTALL_BZ2}
          - INSTALL_GMP=${PHP_FPM_INSTALL_GMP}
          - INSTALL_XDEBUG=${PHP_FPM_INSTALL_XDEBUG}
          - INSTALL_PCOV=${PHP_FPM_INSTALL_PCOV}
          - INSTALL_PHPDBG=${PHP_FPM_INSTALL_PHPDBG}
          - INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE}
          - INSTALL_SSH2=${PHP_FPM_INSTALL_SSH2}
          - INSTALL_SOAP=${PHP_FPM_INSTALL_SOAP}
          - INSTALL_XSL=${PHP_FPM_INSTALL_XSL}
          - INSTALL_SMB=${PHP_FPM_INSTALL_SMB}
          - INSTALL_IMAP=${PHP_FPM_INSTALL_IMAP}
          - INSTALL_MONGO=${PHP_FPM_INSTALL_MONGO}
          - INSTALL_AMQP=${PHP_FPM_INSTALL_AMQP}
          - INSTALL_CASSANDRA=${PHP_FPM_INSTALL_CASSANDRA}
          - INSTALL_GEARMAN=${PHP_FPM_INSTALL_GEARMAN}
          - INSTALL_MSSQL=${PHP_FPM_INSTALL_MSSQL}
          - INSTALL_BCMATH=${PHP_FPM_INSTALL_BCMATH}
          - INSTALL_PHPREDIS=${PHP_FPM_INSTALL_PHPREDIS}
          - INSTALL_MEMCACHED=${PHP_FPM_INSTALL_MEMCACHED}
          - INSTALL_OPCACHE=${PHP_FPM_INSTALL_OPCACHE}
          - INSTALL_EXIF=${PHP_FPM_INSTALL_EXIF}
          - INSTALL_AEROSPIKE=${PHP_FPM_INSTALL_AEROSPIKE}
          - INSTALL_OCI8=${PHP_FPM_INSTALL_OCI8}
          - INSTALL_MYSQLI=${PHP_FPM_INSTALL_MYSQLI}
          - INSTALL_PGSQL=${PHP_FPM_INSTALL_PGSQL}
          - INSTALL_PG_CLIENT=${PHP_FPM_INSTALL_PG_CLIENT}
          - INSTALL_POSTGIS=${PHP_FPM_INSTALL_POSTGIS}
          - INSTALL_INTL=${PHP_FPM_INSTALL_INTL}
          - INSTALL_GHOSTSCRIPT=${PHP_FPM_INSTALL_GHOSTSCRIPT}
          - INSTALL_LDAP=${PHP_FPM_INSTALL_LDAP}
          - INSTALL_PHALCON=${PHP_FPM_INSTALL_PHALCON}
          - INSTALL_SWOOLE=${PHP_FPM_INSTALL_SWOOLE}
          - INSTALL_TAINT=${PHP_FPM_INSTALL_TAINT}
          - INSTALL_IMAGE_OPTIMIZERS=${PHP_FPM_INSTALL_IMAGE_OPTIMIZERS}
          - INSTALL_IMAGEMAGICK=${PHP_FPM_INSTALL_IMAGEMAGICK}
          - INSTALL_CALENDAR=${PHP_FPM_INSTALL_CALENDAR}
          - INSTALL_FAKETIME=${PHP_FPM_INSTALL_FAKETIME}
          - INSTALL_IONCUBE=${PHP_FPM_INSTALL_IONCUBE}
          - INSTALL_APCU=${PHP_FPM_INSTALL_APCU}
          - INSTALL_CACHETOOL=${PHP_FPM_INSTALL_CACHETOOL}
          - INSTALL_YAML=${PHP_FPM_INSTALL_YAML}
          - INSTALL_RDKAFKA=${PHP_FPM_INSTALL_RDKAFKA}
          - INSTALL_GETTEXT=${PHP_FPM_INSTALL_GETTEXT}
          - INSTALL_ADDITIONAL_LOCALES=${PHP_FPM_INSTALL_ADDITIONAL_LOCALES}
          - INSTALL_MYSQL_CLIENT=${PHP_FPM_INSTALL_MYSQL_CLIENT}
          - INSTALL_PING=${PHP_FPM_INSTALL_PING}
          - INSTALL_SSHPASS=${PHP_FPM_INSTALL_SSHPASS}
          - INSTALL_MAILPARSE=${PHP_FPM_INSTALL_MAILPARSE}
          - INSTALL_PCNTL=${PHP_FPM_INSTALL_PCNTL}
          - ADDITIONAL_LOCALES=${PHP_FPM_ADDITIONAL_LOCALES}
          - INSTALL_FFMPEG=${PHP_FPM_FFMPEG}
          - INSTALL_AUDIOWAVEFORM=${PHP_FPM_AUDIOWAVEFORM}
          - INSTALL_WKHTMLTOPDF=${PHP_FPM_INSTALL_WKHTMLTOPDF}
          - INSTALL_XHPROF=${PHP_FPM_INSTALL_XHPROF}
          - INSTALL_XMLRPC=${PHP_FPM_INSTALL_XMLRPC}
          - DOWNGRADE_OPENSSL_TLS_AND_SECLEVEL=${PHP_DOWNGRADE_OPENSSL_TLS_AND_SECLEVEL}
          - PUID=${PHP_FPM_PUID}
          - PGID=${PHP_FPM_PGID}
          - IMAGEMAGICK_VERSION=${PHP_FPM_IMAGEMAGICK_VERSION}
          - LOCALE=${PHP_FPM_DEFAULT_LOCALE}
          - PHP_FPM_NEW_RELIC=${PHP_FPM_NEW_RELIC}
          - PHP_FPM_NEW_RELIC_KEY=${PHP_FPM_NEW_RELIC_KEY}
          - PHP_FPM_NEW_RELIC_APP_NAME=${PHP_FPM_NEW_RELIC_APP_NAME}
          - INSTALL_DOCKER_CLIENT=${PHP_FPM_INSTALL_DOCKER_CLIENT}
          - http_proxy
          - https_proxy
          - no_proxy
      volumes:
        - ./php-fpm/php${PHP_VERSION}.ini:/usr/local/etc/php/php.ini
        - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}${APP_CODE_CONTAINER_FLAG}
        - docker-in-docker:/certs/client
      ports:
        - "${PHP_FPM_XDEBUG_PORT}:9003"
      expose:
        - "9000"
      extra_hosts:
        - "dockerhost:${DOCKER_HOST_IP}"
      environment:
        - PHP_IDE_CONFIG=${PHP_IDE_CONFIG}
        - DOCKER_HOST=tcp://docker-in-docker:2376
        - DOCKER_TLS_VERIFY=1
        - DOCKER_TLS_CERTDIR=/certs
        - DOCKER_CERT_PATH=/certs/client
        - FAKETIME=${PHP_FPM_FAKETIME}
      depends_on:
        - workspace
      networks:
        - backend
      links:
        - docker-in-docker

### PHP Worker ############################################
    php-worker:
      build:
        context: ./php-worker
        args:
          - CHANGE_SOURCE=${CHANGE_SOURCE}
          - LARADOCK_PHP_VERSION=${PHP_VERSION}
          - PHALCON_VERSION=${PHALCON_VERSION}
          - INSTALL_BZ2=${PHP_WORKER_INSTALL_BZ2}
          - INSTALL_GD=${PHP_WORKER_INSTALL_GD}
          - INSTALL_IMAGEMAGICK=${PHP_WORKER_INSTALL_IMAGEMAGICK}
          - INSTALL_GMP=${PHP_WORKER_INSTALL_GMP}
          - INSTALL_PGSQL=${PHP_WORKER_INSTALL_PGSQL}
          - INSTALL_MONGO=${PHP_WORKER_INSTALL_MONGO}
          - INSTALL_BCMATH=${PHP_WORKER_INSTALL_BCMATH}
          - INSTALL_OCI8=${PHP_WORKER_INSTALL_OCI8}
          - INSTALL_PHALCON=${PHP_WORKER_INSTALL_PHALCON}
          - INSTALL_SOAP=${PHP_WORKER_INSTALL_SOAP}
          - INSTALL_ZIP_ARCHIVE=${PHP_WORKER_INSTALL_ZIP_ARCHIVE}
          - INSTALL_MYSQL_CLIENT=${PHP_WORKER_INSTALL_MYSQL_CLIENT}
          - INSTALL_AMQP=${PHP_WORKER_INSTALL_AMQP}
          - INSTALL_CASSANDRA=${PHP_WORKER_INSTALL_CASSANDRA}
          - INSTALL_GEARMAN=${PHP_WORKER_INSTALL_GEARMAN}
          - INSTALL_GHOSTSCRIPT=${PHP_WORKER_INSTALL_GHOSTSCRIPT}
          - INSTALL_SWOOLE=${PHP_WORKER_INSTALL_SWOOLE}
          - INSTALL_TAINT=${PHP_WORKER_INSTALL_TAINT}
          - INSTALL_FFMPEG=${PHP_WORKER_INSTALL_FFMPEG}
          - INSTALL_AUDIOWAVEFORM=${PHP_WORKER_INSTALL_AUDIOWAVEFORM}
          - INSTALL_REDIS=${PHP_WORKER_INSTALL_REDIS}
          - INSTALL_IMAP=${PHP_WORKER_INSTALL_IMAP}
          - INSTALL_XMLRPC=${PHP_WORKER_INSTALL_XMLRPC}
          - PUID=${PHP_WORKER_PUID}
          - PGID=${PHP_WORKER_PGID}
          - IMAGEMAGICK_VERSION=${PHP_WORKER_IMAGEMAGICK_VERSION}
      volumes:
        - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}${APP_CODE_CONTAINER_FLAG}
        - ./php-worker/supervisord.d:/etc/supervisord.d
      depends_on:
        - workspace
      extra_hosts:
        - "dockerhost:${DOCKER_HOST_IP}"
      networks:
        - backend

### NGINX Server #########################################
    nginx:
      build:
        context: ./nginx
        args:
          - CHANGE_SOURCE=${CHANGE_SOURCE}
          - PHP_UPSTREAM_CONTAINER=${NGINX_PHP_UPSTREAM_CONTAINER}
          - PHP_UPSTREAM_PORT=${NGINX_PHP_UPSTREAM_PORT}
          - http_proxy
          - https_proxy
          - no_proxy
      volumes:
        - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}${APP_CODE_CONTAINER_FLAG}
        - ${NGINX_HOST_LOG_PATH}:/var/log/nginx
        - ${NGINX_SITES_PATH}:/etc/nginx/sites-available
        - ${NGINX_SSL_PATH}:/etc/nginx/ssl
      ports:
        - "${NGINX_HOST_HTTP_PORT}:80"
        - "${NGINX_HOST_HTTPS_PORT}:443"
        - "${VARNISH_BACKEND_PORT}:81"
      depends_on:
        - php-fpm
      networks:
        - frontend
        - backend

### MariaDB ##############################################
    mariadb:
      build:
        context: ./mariadb
        args:
          - http_proxy
          - https_proxy
          - no_proxy
          - MARIADB_VERSION=${MARIADB_VERSION}
      volumes:
        - ${DATA_PATH_HOST}/mariadb:/var/lib/mysql
        - ${MARIADB_ENTRYPOINT_INITDB}:/docker-entrypoint-initdb.d
      ports:
        - "${MARIADB_PORT}:3306"
      environment:
        - TZ=${WORKSPACE_TIMEZONE}
        - MYSQL_DATABASE=${MARIADB_DATABASE}
        - MYSQL_USER=${MARIADB_USER}
        - MYSQL_PASSWORD=${MARIADB_PASSWORD}
        - MYSQL_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD}
      networks:
        - backend

### MongoDB ##############################################
    mongo:
      build: ./mongo
      ports:
        - "${MONGODB_PORT}:27017"
      volumes:
        - ${DATA_PATH_HOST}/mongo:/data/db
        - ${DATA_PATH_HOST}/mongo_config:/data/configdb
      networks:
        - backend

### Redis ################################################
    redis:
      build: ./redis
      volumes:
        - ${DATA_PATH_HOST}/redis:/data
      ports:
        - "${REDIS_PORT}:6379"
      networks:
        - backend

### phpMyAdmin ###########################################
    phpmyadmin:
      build: ./phpmyadmin
      environment:
        - PMA_ARBITRARY=1
        - MYSQL_USER=${PMA_USER}
        - MYSQL_PASSWORD=${PMA_PASSWORD}
        - MYSQL_ROOT_PASSWORD=${PMA_ROOT_PASSWORD}
        - MAX_EXECUTION_TIME=${PMA_MAX_EXECUTION_TIME}
        - MEMORY_LIMIT=${PMA_MEMORY_LIMIT}
        - UPLOAD_LIMIT=${PMA_UPLOAD_LIMIT}
      ports:
        - "${PMA_PORT}:80"
      depends_on:
        - "${PMA_DB_ENGINE}"
      networks:
        - frontend
        - backend

### Laravel Echo Server #######################################
    laravel-echo-server:
      build:
        context: ./laravel-echo-server
        args:
          - CHANGE_SOURCE=${CHANGE_SOURCE}
      volumes:
        - ./laravel-echo-server/laravel-echo-server.json:/app/laravel-echo-server.json:ro
      ports:
        - "${LARAVEL_ECHO_SERVER_PORT}:6001"
      links:
        - redis
      networks:
        - frontend
        - backend

### Docker-in-Docker ################################################
    docker-in-docker:
      image: docker:19.03-dind
      environment:
        DOCKER_TLS_SAN: DNS:docker-in-docker
      privileged: true
      volumes:
        - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}
        - docker-in-docker:/certs/client
      expose:
        - 2375
      networks:
        - backend
 

Комментарии:

1. Можете ли вы поделиться файлами докеров?

2. @MarkoE Я обновил сообщение с nginx помощью DockerFile

3. Ошибка предполагает, что файл docker-compose.yml… можете ли вы также опубликовать это?

4. @Ivonet да, мой пост обновлен, пожалуйста, просмотрите его еще раз

5. Почему вы не можете остановить или удалить nginx службу на своем хост-компьютере? Ошибка, которую вы получаете, в основном говорит вам, что вы не можете перенаправить порт 443 на свою хост-машину, потому что он уже используется (by nginx ).

Ответ №1:

Я видел проект, о котором вы упомянули в LaraDock, так что я предполагаю, что именно отсюда Dockerfile и docker-compose.yml произошло.


Прежде всего, давайте решим проблему, в сообщении об ошибке содержится 2 информации:

  1. Воссоздание laradock_nginx_1
  2. прослушайте tcp4 0.0.0.0:443: привязка: адрес уже используется

Вот ключ к исправлению этих:

Очистите предыдущие контейнеры

для фиксации Recreating laradock_nginx_1

  1. Убедитесь, что предыдущее Nginx container очищено, в большинстве случаев это должно быть сделано автоматически с помощью «docker-compose», но вы всегда можете сделать это вручную:
    1. убедитесь, что внутри этих контейнеров нет ничего важного
    2. docker-compose kill amp;amp; docker-compose rm

Убедитесь, что целевой порт доступен

для фиксации listen tcp4 0.0.0.0:443: bind: address already in use

Внутри контейнера всегда не должно быть проблем с портом, поэтому вам нужно проверить порт host machine , запустить это на своем сервере и проверить, какой прогресс занял 443 порт:

  1. netstat -apn | grep 443
  2. убейте этот прогресс, если сможете

Как change Nginx host port to 8080 часть.

Docker использует мостовую сеть по умолчанию, у каждого контейнера будет свое собственное сетевое пространство имен, что означает, что каждая измененная вами конфигурация сети произошла внутри контейнера и почти не имеет отношения к сети на вашем сервере.

Если вы хотите изменить порт привязки на своем сервере, вам следует изменить docker-compose.yml , например, здесь, это приведет к тому, что docker-compose свяжет порт внутри вашего контейнера Nginx с новым на вашем сервере