Score:0

Best way to trigger host to restart a docker container from inside another docker container?

cn flag

I have a docker container that manages all of the SSL certificates for my services with Letsencrypt. When the certificate for a certain service is renewed, a post-hook script copies the certificate and key to the folder where the SSL certificate and key for the other container uses are located. This other container then needs to be restarted to use the new, renewed certificate. My current solution is exposing the docker host to the letsencrypt container like this in docker compose:

    extra_hosts:
      - "host.docker.internal:host-gateway"

and I can then place my private SSH key in the letsencrypt container, and run the docker compose command to restart the other container from an SSH session in the post-hook script.

However, I realise that this isn't ideal as it allows root access to the docker host from the letsencrypt container, which wouldn't be good if it was compromised.

My question is: is there any better way to make the docker host restart a container from inside another container?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.