0
0
Dockerdevops~10 mins

Running containers in detached mode 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 in detached mode.

Docker
docker run [1] nginx
Drag options to blanks, or click blank then click option'
A-d
B-it
C--rm
D-p
Attempts:
3 left
💡 Hint
Common Mistakes
Using -it runs the container interactively, not detached.
Using --rm removes the container after it stops, unrelated to detached mode.
Using -p is for port mapping, not for detached mode.
2fill in blank
medium

Complete the command to run a container named 'webapp' in detached mode.

Docker
docker run [1] --name webapp nginx
Drag options to blanks, or click blank then click option'
A-it
B-p
C--rm
D-d
Attempts:
3 left
💡 Hint
Common Mistakes
Using -it runs the container interactively.
Using --rm removes the container after exit.
Using -p maps ports but does not detach.
3fill in blank
hard

Fix the error in the command to run a container in detached mode.

Docker
docker run nginx [1]
Drag options to blanks, or click blank then click option'
A-d
B-it
C--rm
D-p
Attempts:
3 left
💡 Hint
Common Mistakes
Placing the flag after the image name causes an error.
Using -it runs interactively, not detached.
4fill in blank
hard

Fill both blanks to run a container in detached mode and map port 8080 on the host to 80 in the container.

Docker
docker run [1] -p [2]:80 nginx
Drag options to blanks, or click blank then click option'
A-d
B8080
C80
D-it
Attempts:
3 left
💡 Hint
Common Mistakes
Using -it instead of -d for detached mode.
Swapping port numbers in the mapping.
5fill in blank
hard

Fill all three blanks to run a container detached, name it 'db', and map port 3306 on the host to 3306 in the container.

Docker
docker run [1] --name [2] -p [3]:3306 mysql
Drag options to blanks, or click blank then click option'
A-d
Bdb
C3306
D-it
Attempts:
3 left
💡 Hint
Common Mistakes
Using -it instead of -d for detached mode.
Incorrect port mapping format.
Forgetting to name the container.