nginx-proxy / nginx-proxy/docker-gen

docker-gen exits with status code 2

Open
#201 19 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
4.6k
Forks
609
Avg merge
2d 18h
Merged PRs (30d)
4

Description

I've been pulling my hair out all night. As far as i can tell - running docker-gen as a container - the container should continue running. However, i have an intermitient situation where the container exits with status code 2.

when this happens, my config files are not being created..

this is the docker-compose file (with some omissions for privacy) - does it look right? It's essentially copied out of the examples with paths updates her and there.

version: '2'

services:
  node:
    # node image
    build: "docker-node"
    container_name: node
    volumes:
      - ./volumes/www:/data/app
    ports:
      - "3000:3000"
    environment:
      NODE_ENV: "development"
    working_dir: /data/app
    command: ["npm install; npm run develop"]

  nginx:
    image: nginx
    container_name: nginx
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "/etc/nginx/conf.d"
      - "/etc/nginx/vhost.d"
      - "/usr/share/nginx/html"
      - "./volumes/proxy/certs:/etc/nginx/certs:ro"
    networks:
      - proxy-tier
  nginx-gen:
    image: jwilder/docker-gen
    container_name: nginx-gen
    depends_on:
      - letsencrypt-nginx-proxy-companion
      - simple-site
      - nginx
    volumes:
      - "/var/run/docker.sock:/tmp/docker.sock:ro"
      - "./volumes/proxy/templates/nginx-compose-v2.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro"
    volumes_from:
      - nginx
    entrypoint: /usr/local/bin/docker-gen -notify-sighup nginx -watch -only-exposed -wait 30s:60s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
  letsencrypt-nginx-proxy-companion:
    image: jrcs/letsencrypt-nginx-proxy-companion
    container_name: letsencrypt-nginx-proxy-companion
    volumes_from:
      - nginx
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "./volumes/proxy/certs:/etc/nginx/certs:rw"
    environment:
      - NGINX_DOCKER_GEN_CONTAINER=nginx-gen

  simple-site:
    image: nginx
    container_name: simple-site
    depends_on:
      - letsencrypt-nginx-proxy-companion
    volumes:
      - "./volumes/nginx.conf/www/conf.d/:/etc/nginx/conf.d"
      - "./volumes/www/public:/usr/share/nginx/html"
    environment:
      - VIRTUAL_HOST=xxxxx
      - VIRTUAL_NETWORK=nginx-proxy
      - VIRTUAL_PORT=80
      - LETSENCRYPT_HOST=xxxxx
      - LETSENCRYPT_EMAIL=xxxxx
    networks:
      - proxy-tier

networks:
  proxy-tier:
    external:
      name: nginx-proxy

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied docker-compose configuration, especially the nginx-gen entrypoint, volumes, and docker-gen command. Reproduce the intermittent status code 2 and inspect the container output to determine why config files are not created. Done means the cause is identified and the relevant configuration or invocation is corrected and verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
devops, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.