If this is not the right place to post this question, please let me know! I am using the
golang docker client/SDK to build a script which is responsible for starting up an application in a Docker container. I’d like that script to ensure that the application is always running, so if it crashes or something else kills it, I’d like the script (or Docker) to pick that up and restart the container.
Currently, I have that implemented using
ContainerWait: https://godoc.org/github.com/docker/docker/client#Client.ContainerWait which has been successful.
However, I’m thinking about achieving this using a Restart Policy: https://docs.docker.com/engine/reference/run/#restart-policies---restart to move some of this logic out of my script and let Docker do the heavy lifting.
Does this seem like a better option, using the
always restart policy? Just looking for general thoughts/suggestions here if anyone has insight/experience in this.