-
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
Allow -notify-sigup to work with docker-compose #77
Comments
This docker-compose 0.4 came the ability to add a I played around with it today:
You'll have to change |
If you start more than one instance of your docker-compose orchestration (i.e. you sometimes have a *_nginx_2 container), you can use this in your entrypoint shell script:
|
Came digging through the issues for this topic exactly. Like #82, it'd be nice to be able to flag the nginx container with a value that docker-gen can identify as its SIGHUP target. |
same problem... testing currently with ranger. But it's a problem of orchestration (usually with docker-compose). |
I think labels would be the best option to go as it will work independently of compose or any other technology. |
@darkwinternight where does the |
@jayfk well it has to be present inside the container, of course. You will also need to mount the docker socket into the container |
having the same situation with docker-compose. is there still movement in this issue ? |
I'm working with this inside Rancher and would like to see this happen. I don't have enough time right this instant, but let's try and make a roadmap.
To develop this, the Docker image for this repo will need to be built and tested against a functioning Swarm/Rancher stack. If we're really ambitious, we could try writing tests too... but this is pretty much my first time writing Go. |
docker-gen has the ability to use an config file as described here In the rancher environment we have the rancher metadata service which is quite helpful with the described problem. But all in all you can build an solution to your problem with docker-compose by our own. Create your own image with an small bash script which searches for the flag in all available docker containers and use the uuid of that container in the config-file. The only thing you need to take care of is that this script is running after all containers are created and before they are started. Afaik it is possible to define this order. |
@Munsio unfortunately Rancher assigns random and unique names to containers, so specifying the container notification in the template won't match What we would like to do here is add the ability for docker-gen to notify containers based on label, not just name or id. Is there an easier way to accomplish this? |
Maybe i was unclear - i didn't mean that my solution is the solution for everything i know that it is an workaround and that an implemented feature which lets us use a label for sighub signals is definitely better, unfortunately until we get this feature we have to use this workarounds. And about the name thats why i mentioned to run the script every time after the container gets created and before it gets started. |
What about auto container discovery based on mounts? Docker-gen could detect it is running in container, and if it is generating some files they are probably mounted in some other container/containers. Docker - gen could find these containers and notify them all. Would cover scaled compose services, rancher, and swarm environment. Of course it would have to pay attention to nodes/hosts but seems doable. Finding containers by labels is ok but it may be harder to maintain. If you think it makes sense I'm willing to spend some time on it and prepare PR. |
After 8-9 years, let me just say that I am personally very delighted. |
In a docker-compose situation, the container name isn't known in advance. A way to tell -notify-sigup to pull the container name from an environment variable (ie $nginx_NAME) would be helpful.
After more reading, I might be misunderstanding how docker-compose sets the environment variables.
I'm looking for a solution to putting docker-gen in a separate container from nginx and still being able to use -notify-sigup on the container which gets turned into _nginx_1 and not really known ahead of time (unless you assume how docker-compose is going to name the containers).
This might get solved in a future release when docker-compose includes the ability to name your containers whatever you'd like.
The text was updated successfully, but these errors were encountered: