-
Notifications
You must be signed in to change notification settings - Fork 604
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
Restart unless stopped not working #244
Comments
I have the same problem. But also "always" does not work. After restart of the server I have to startup docker-gen manually. How can I find the reason for the exited docker-image? Why does it not restart automatically when I use always? |
I'm hitting the same issue - docker-gen container + nginx container - both restart=always - if I restart the docker service, nginx comes back up but docker-gen remains stopped with an exit code of 2 Nothing obvious in the logs Docker start will get the container running again |
Yep, exactly the same for me. Possible to fix this issue? It is very annoying in a production environment. |
docker update --restart=unless-stopped 7e99ccfb8139 DOES NOT WORK.... |
We’re also experiencing the same issue. |
Same issue here, every time the server rebooted or after ran my auto backup program. All other containers would be up except docker-gen. |
Same here, is it something with nginx.tmpl or latest version of docker ce? |
Due to problems with letsencrypt-nginx-proxy-companion I removed this component. Since then I didn't have any problems after reboot. Is it possible that letsencrypt-nginx-proxy-companion causes this trouble? |
Has anyone found any solutions to this? I'm facing the same problem. If I reboot the server everything gets up and running except |
I have the same problem. I assume the docker-letsencrypt-nginx-proxy-companion container most people will use with it, causes the problem. And only when another app/container triggers the letsencrypt container to do it's work. I Have done some tests with different combinations of containers and only when there was a container that triggerd the letsencrypt container, i got a exited (2) after a server-reboot or docker-machine restart. And not always, but around ~75% of the times. |
We worked around this problem by wrapping docker-gen in a shell script that executes docker-gen in a loop and traps SIGHUP and SIGTERM signals: #!/bin/sh
echo container started
echo parameters: $@
hup() {
echo SIGHUP received
if [ -z "$docker_gen_pid" ]
then
echo no pid: signal ignored
else
echo sending signal to pid: $docker_gen_pid
kill -HUP $docker_gen_pid
fi
wait
}
trap hup SIGHUP
term() {
echo SIGTERM received
if [ -z "$docker_gen_pid" ]
then
exit 0
else
echo killing pid: $docker_gen_pid
kill $docker_gen_pid
wait
exit_code=$?
echo docker-gen terminated with exit code: $exit_code
exit $exit_code
fi
}
trap term SIGTERM
while :
do
echo starting docker-gen...
/usr/local/bin/docker-gen $@ &
docker_gen_pid=$!
wait
docker_gen_pid=
echo docker-gen terminated with exit code: $?
sleep 10
done |
I'm facing the same problem. I use https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion and after server reboot docker-gen doesn't run. At the first reboot nginx-proxy dont work. After docker-compose restart all next reboot doesn't break docker-proxy, but docker-gen anyway doesn't start and i don't know how bad this is.
Now i just set this cronjob: |
Any Progress with this Issue? I have same issue on Ubuntu 18.04 with Docker-CE 18.09.1. I can see it for months now :( |
I'm using CoreOS with Docker version 18.06.1-ce. Also hit by this issue. |
Same here. Ubuntu 18.04. |
We're having the same issue: nginx-gen randomly goes into the "stopped" state, even though we have a restart directive... |
Thank you @copierrj . Your wrapper works very good. I put it in a file called
command is emptied when you define a new entrypoint, so you have to specify both. |
the restart policy of docker only has effect after 10 seconds. https://docs.docker.com/config/containers/start-containers-automatically/#restart-policy-details
If nginx-gen is faster at startup than nginx, it has an error when connecting to the nginx container and crashes with "Exit 2" |
Cause
FixYou can use the docker image based on my fork: joellinn/docker-gen. It's also build with up to date dependencies. (I don't fancy advertising forks but this project unfortunately seems to be unmaintained...) |
Still happens with your image. :( |
Under which environment are you running the image? How does it "stop" (Status in docker ps). Is there any hint in the logs? |
Thanks @JoelLinn , your docker image works great, now when i do docker-compose down and docker-compose up -d , all my containers start without any error |
I noticed
restart: unless-stopped
is not working in docker-gen. Do I need to usealways
instead? Why is it not working?The text was updated successfully, but these errors were encountered: