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
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/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.