-
Notifications
You must be signed in to change notification settings - Fork 612
docker-gen exits with status code 2 #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm having a similar issue: |
I'm having a similar problem. |
I resolved my issue by changing the entrypoint to the default "/bin/sh -c" and moving the entrypoint command "docker-gen xxx" to the 'command' The relevant docker-compose.yml snippet looks like: nginx-gen:
image: jwilder/docker-gen
container_name: nginx-gen
depends_on:
- letsencrypt-nginx-proxy-companion
- nginx
- mailer
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: /bin/sh -c
command: ["/usr/local/bin/docker-gen -notify-sighup nginx -only-exposed -watch -wait 30s:60s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf"]
|
It's worked for me too. |
Glad i could help. |
@arcticShadow I've been having this same issue as well -- the docker-gen container seems to run fine for days until it's terminated randomly for some reason. I've used your fix regarding the change in entrypoint and CMD and so far, so good. Could you explain why changing the entrypoint to |
Same problem here. @arcticShadow's workaround works (why?) but it removes the graceful shutdown. |
I'm not sure why it happens. I haven't looked at this issue or the project i encountered it on in quite some time. |
It looks like the problem is with the order in which containers are started. So just run: |
I tried to use @arcticShadow solution but it doesn't work. |
@murbanowicz you should copy the volumes folder into your own project. otherwise docker compose will generate a folder with the name of the file you're trying to share to the container (/etc/docker-gen/templates/nginx.tmpl). If this is the case, as soon as you copy the /etc/docker-gen/templates/nginx.tmpl, it will be parsed correctly. |
I was able to reliably reproduce this - I was using the recommended setup for ngnix+letsecrypt+docker-gen containers - any attempt to restart docker resulted in the docker-gen container being stopped with an exit status of 2 - despite 'restart=always' The recommended setup sets the container to always be the same - |
I also had the issue that docker-gen would not start occasionally after reboot. Took me some very long time. Changing the entrypoint to |
Please note that the entrypoint/cmd workaround seems to break the letsencrypt-nginx-proxy companion container. The SIGHUP signal sent from the companion to the nginx-proxy is received by the bash process, instead of the docker-gen process, and it does not seem like it's propagated through the bash process to the docker-gen process. |
I have noted that. Workaround. Every 2.5 months I manaukly kick the containers to restart them :-/ obviously this isn't the best solution. Would log to revisit this one day to find out what's really going on, or if this is still an issue. |
@arcticShadow s solution worked for me. But first I had to delete the container with docker-compose down Unfortunately the @Thomaco appears :-( |
I was having the same problem. Fixed with this: |
I tried the aforementioned workaround but I get the following error:
ie. it seems it refuses to start when run within |
It's only me being stupid and tired: the command line passed to |
As with all things modern, I had to do some weird stuff. For instance, I needed to change the command and entrypoint because docker-gen was crashing. nginx-proxy/docker-gen#201 I also am now trying to mount the conf file as a volume to get it copied over since the COPY command in the Dockerfile.nginx seems to be ignored by docker-compose. Starting the container on it's own will lead to the file being copied. It does not appear when started with the other containers (via docker-compose). The file Dockerfile.nginx will no longer be necessary.
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.
The text was updated successfully, but these errors were encountered: