Send a signal via rancher api?

I try to replace my docker-gen (single host) with rancher-gen (multi host, rancher environment). With the docker-gen I have a simple shell script to send a sigusr1 signal to a docker container via docker.sock.


set -x

CONTAINER=$(echo -e "GET /containers/json?filters={\"label\":[\"$REVPROXY_CADDY\"]} HTTP/1.0\r\n" | nc -U $DOCKER_SOCK | grep -o '"Id":".*","Names"' | sed 's/^"Id":"//' | sed 's/","Names"//')
echo -e "POST /containers/$CONTAINER/kill?signal=SIGUSR1 HTTP/1.0\r\n" | nc -U $DOCKER_SOCK

How to do it the rancher way?

Know anyone an example how to send a signal to a container via rancher api?

Could anyone help me here?
I need a way to send kill signal (sigusr1) to all containers (rancher, environment with multiple hosts) which have a custom label.

The script above works fine with single host sending signal via docker.sock.


There is no rancher api for sending signals. It’s not pretty but you can use exec…

Hi @vincent,

you mean “docker exec …”?
No way to send the signal remote to all containers with that label? The containers running on three rancher hosts.

You’re talking about the API so I mean the execute action on a container. As I said there is no killor equivalent action in the Rancher API that calls kill in the Docker remote API.

Arbitrary label selection is not part of the API either so you’d need either a selector service defined with them and then loop over the instances of that, or get all the containers and filter those matching your label(s) yourself.