Reputation: 7729
In my Dockerfile
, I start a process using CMD:
# Start MyProcess
CMD ./my_process.sh >> /log/myprocess.log
my_process.sh
may exit 0
according to some conditions inside that script. Is there a way to safely stop the container from running/starting? right now, it keeps restarting indefinitely
Upvotes: 1
Views: 67
Reputation: 14893
You can try leveraging restart policies, add below argument during docker run
-
docker run --restart on-failure .....
--restart on-failure
Restart only if the container exits with a non-zero exit status. Optionally, limit the number of restart retries the Docker daemon attempts.
Ref - https://docs.docker.com/engine/reference/commandline/run/
Upvotes: 2