Replies: 3 comments
-
|
Jufis, This is best handled within your container. See here for details on the different signals https://www.ctl.io/developers/blog/post/gracefully-stopping-docker-containers/. Not sure we would be adding this capability into Portainer in the near term. |
Beta Was this translation helpful? Give feedback.
-
|
I actually have another use for the same request. I would like to set For example, as soon as the
which would create I can easily run this manually as soon as I know the docker container has been started/restarted. But a built-in post-start/restart-script support in Portainer would be so much help. Right now, as an ugly workaround, I have to script it as a cron job on the docker host system, and run it pretty much every minute (with a set of controls and checks, of course). In the worst case scenario, there's a one minute delay between the container's start/restart and my cron job running. In some cases, that's too long to wait. UPDATE: I've been thinking, after posting this request, that this would need to be done by the docker daemon. Because I'm not sure how Portainer would be able to run a script on a remote docker host. Or, maybe via Portainer agent? Anyways, just a thought. |
Beta Was this translation helpful? Give feedback.
-
|
Hello, ill try the same. Using a script based on https://github.com/deitch/ctables/blob/master/ctables Are iam able to run this on portainer, after the container got started? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
It would be good to have a configuration section to run custom scripts on the host running the docker daemon before and/or after a container action (stop/start/pause/restart) has occurred.
For example: I want to run a script before I try to stop a container. Portainer in that case will call my custom.sh script with an argument which is the container id. The custom script can figure out everything about this container using its container id and run custom functions on the host vm running the container. An example of a custom action could be to drain connections before stopping a container. Or sending an e-mail to the administrator etc etc.
Beta Was this translation helpful? Give feedback.
All reactions