Skip to content

/etc/nginx/conf.d/default.conf differs from the packaged version, exiting #419

@matuszewskijan

Description

@matuszewskijan

Hello, I am trying to setup Rails application with ngnix, but no matter what I do I am always getting this error: nginx_1 | 10-listen-on-ipv6-by-default.sh: /etc/nginx/conf.d/default.conf differs from the packaged version, exiting when using: sudo docker-compose -f docker-compose.prod.yml up command any similar.

My Dockerfile-nginx:

FROM nginx:1.19.0

RUN apt-get update -qq && apt-get -y install apache2-utils

ENV RAILS_ROOT /var/www/app

WORKDIR $RAILS_ROOT

RUN mkdir log

COPY public public/

# When I try to pass config using Copy the same error happens, I prefer using compose volume.
# COPY config/containers/ssl/default.conf /tmp/docker.nginx
# RUN envsubst '$RAILS_ROOT' < /tmp/docker.nginx > /etc/nginx/conf.d/default.conf

EXPOSE 80 443

CMD [ "nginx", "-g", "daemon off;" ]

docker-compose.prod.yml:

version: '2'

services:
  mysql:
    image: 'mysql:5.7'
    environment:
      ...
    ports:
      - "3307:3306"

  redis:
    image: 'redis:3.2.1-alpine'
    command: redis-server
    volumes:
      - 'redis:/data'

  website:
    depends_on:
      - 'mysql'
      - 'redis'
      - 'sidekiq'
    build: .
    ports:
      - '3000:3000'
    environment:
      RAILS_ENV: production
    env_file: .env

  sidekiq:
    depends_on:
      - 'mysql'
      - 'redis'
    build: .
    command: bundle exec sidekiq
    volumes:
      - '.:/website'
    environment:
      REDIS_URL: redis://redis:6379/0

  nginx:
    build:
      context: .
      dockerfile: ./config/containers/Dockerfile-nginx
    volumes:
      - ./config/containers/default.conf:/etc/nginx/conf.d/default.conf
    depends_on:
      - website
    ports:
      - "80:80"


volumes:
  redis:
  mysql:

And default.conf:

server {
  listen 80;
}

Anyone is having any idea why it happen? I've tried everything what comes to my mind to fix it. I wonder how the Conffiles are generated as it seems to be the source of the issue: https://github.com/nginxinc/docker-nginx/blob/master/mainline/alpine/10-listen-on-ipv6-by-default.sh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions