Skip to content

docker-gen only gets triggered for certain container launch methods #59

@bhansley

Description

@bhansley

Error description:

After launching what should be the same container in multiple ways, docker-gen is only triggered for start_test.sh and a docker start... from the bash CLI. A bash script - with the same command - and docker-compose never trigger docker-gen. I'm sure it's something I'm doing wrong, but if it is, I'm not seeing it. Any help is welcome!

1. Launch using start_test.sh - status: WORKS!

$ ./test_start.sh home.ohana.net

The page renders the Apache "It works!" message, and docker-gen shows as being triggered in the logs:

2018/03/28 11:45:24 Received event start for container 0fbe8b559fd2
2018/03/28 11:45:29 Debounce minTimer fired
2018/03/28 11:45:29 Generated '/etc/nginx/conf.d/default.conf' from 6 containers
2018/03/28 11:45:29 Sending container 'nginx-web' signal '1'

and the right entry is created in default.conf:

# home.ohana.net
upstream home.ohana.net {
                                ## Can be connected with "webproxy" network
                        # test-web
                        server 172.21.0.5:80;
}
server {
        server_name home.ohana.net;
        listen 80 ;
        access_log /var/log/nginx/access.log vhost;
        include /etc/nginx/vhost.d/default;
        location / {
                proxy_pass http://home.ohana.net;
        }
}

2. Launch using bash CLI - status: WORKS!

$ docker run -d -e VIRTUAL_HOST=home.ohana.net --network=webproxy --name test-web httpd:alpine

The page renders the Apache "It works!" message, and it shows as being triggered in the logs:

2018/03/28 11:53:58 Received event start for container d06cdb6826c6
2018/03/28 11:54:03 Debounce minTimer fired
2018/03/28 11:54:03 Generated '/etc/nginx/conf.d/default.conf' from 6 containers
2018/03/28 11:54:03 Sending container 'nginx-web' signal '1'

3. Launch using bash script- status: FAIL!

$ ./home.sh

where home.sh looks like this - same command from the CLI in case #2:

#! /bin/bash
docker run -d -e VIRTUAL-HOST=home.ohana.net --network=webproxy --name test-web httpd:alpine

fails.

2018/03/28 12:04:20 Received event start for container 167d4f262495
2018/03/28 12:04:25 Debounce minTimer fired
2018/03/28 12:04:26 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification ''

4. Launch using docker-compose- status: FAIL!

Finally, if I launch with docker compose using:

$ docker-compose up -d

with a docker-compose.yml file that looks like:

version: '3'
services:
  web:
    container_name: test-web
    image: httpd:alpine
    restart: unless-stopped
    network_mode: "bridge"
    environment:
      - VIRTUAL-HOST=home.ohana.net
    hostname: oswald.ohana.net

networks:
  default:
    external:
      name: webproxy

It fails and docker-gen is never triggered.

2018/03/28 12:10:07 Received event start for container 018869db2ff8
2018/03/28 12:10:12 Debounce minTimer fired
2018/03/28 12:10:12 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification ''

Steps to reproduce

As indicated above.

Expected result

Any httpd:alpine - or any web-serving container - that launches should trigger docker-gen to re-create the default.conf file appropriately.

Error result

The proxy's default.conf file is only updated on certain launch methods, resulting in inaccessible web sites.

Comments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions