Docker Community Forums

Share and learn in the Docker community.

Docker golang client, "always" as restart policy or ContainerWait for keeping a container running

(Patrick DeVivo) #1

Hi there,

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: which has been successful.

However, I’m thinking about achieving this using a Restart Policy: 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.