0
0
Dockerdevops~10 mins

Why understanding lifecycle matters in Docker - Test Your Understanding

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

Complete the command to start a Docker container in detached mode.

Docker
docker run -d [1] nginx
Drag options to blanks, or click blank then click option'
A--rm
B-it
C-p 80:80
D-v /data:/data
Attempts:
3 left
💡 Hint
Common Mistakes
Using -it starts an interactive terminal, not detached mode.
Forgetting to map ports means the service won't be reachable.
2fill in blank
medium

Complete the command to list all Docker containers, including stopped ones.

Docker
docker ps [1]
Drag options to blanks, or click blank then click option'
A-q
B--filter
C-l
D-a
Attempts:
3 left
💡 Hint
Common Mistakes
Using -q only shows container IDs.
Using -l shows only the last created container.
3fill in blank
hard

Fix the error in the command to remove a stopped container named 'webapp'.

Docker
docker [1] webapp
Drag options to blanks, or click blank then click option'
Astop
Brm
Crun
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using stop only stops the container but does not remove it.
Using run tries to start a new container.
4fill in blank
hard

Fill both blanks to create a Dockerfile line that copies files and sets the working directory.

Docker
COPY [1] /app/
WORKDIR [2]
Drag options to blanks, or click blank then click option'
A.
B/app
C/usr/src/app
Dsrc
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong source path for COPY causes missing files.
Setting WORKDIR to a different folder than copied files causes confusion.
5fill in blank
hard

Fill all three blanks to write a Docker command that builds an image named 'myapp' from the current directory.

Docker
docker build [1] -t [2] [3]
Drag options to blanks, or click blank then click option'
A--no-cache
Bmyapp
C.
D-f Dockerfile
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the build context '.' causes errors.
Forgetting to tag the image results in an untagged image.