Hands-on task
Restart on failure: --restart
There are two containers on the server, and both stay down after a failure:
workersometimes crashes with an error. Docker should bring it back after a crash with an error — but no more than 5 times in a row; ifworkerexits normally (code 0), it shouldn't be restarted.webshould come back always — after a failure and after Docker restarts — except when it was stopped by hand withdocker stop.
Give both of them suitable restart policies. Don't change the containers' images or commands.
- docker run --restart
- docker update
- restart policy