0
0
Dockerdevops~10 mins

Restart policies in Docker - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to run a Docker container that always restarts.

Docker
docker run --restart=[1] nginx
Drag options to blanks, or click blank then click option'
Aunless-stopped
Balways
Con-failure
Dno
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'no' means the container won't restart automatically.
2fill in blank
medium

Complete the command to restart a container only if it exits with an error.

Docker
docker run --restart=[1] myapp
Drag options to blanks, or click blank then click option'
Aon-failure
Balways
Cno
Dunless-stopped
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'always' restarts even on success, which is not desired here.
3fill in blank
hard

Fix the error in the command to restart a container unless it is stopped manually.

Docker
docker run --restart=[1] myservice
Drag options to blanks, or click blank then click option'
Aunless-stopped
Bno
Calways
Don-failure
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'always' ignores manual stops and restarts anyway.
4fill in blank
hard

Fill both blanks to create a restart policy that restarts on failure but only up to 3 times.

Docker
docker run --restart=[1]:[2] app
Drag options to blanks, or click blank then click option'
Aon-failure
Balways
C3
Dunless-stopped
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'always' with a number is invalid syntax.
5fill in blank
hard

Fill all three blanks to create a Docker run command that restarts always, names the container 'web', and runs in detached mode.

Docker
docker run --restart=[1] --name=[2] -[3] nginx
Drag options to blanks, or click blank then click option'
Aalways
Bweb
Cd
Don-failure
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-f' instead of '-d' for detached mode.