0
0
Dockerdevops~10 mins

Removing containers 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 remove a container named my_container.

Docker
docker container [1] my_container
Drag options to blanks, or click blank then click option'
Arm
Bstart
Crun
Dcreate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'start' instead of 'rm' will try to start the container, not remove it.
Using 'run' or 'create' will create or start containers, not remove them.
2fill in blank
medium

Complete the command to force remove a container with ID abc123.

Docker
docker container rm [1] abc123
Drag options to blanks, or click blank then click option'
A--stop
B-f
C--list
D-d
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--stop' is not a valid option for removal.
Using '-d' is for detached mode, not removal.
3fill in blank
hard

Fix the error in the command to remove all stopped containers.

Docker
docker container rm $(docker ps -a -q [1])
Drag options to blanks, or click blank then click option'
A--filter status=created
B--filter status=running
C--filter status=exited
D--filter status=paused
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'running' will try to remove running containers, which may fail.
Using 'paused' or 'created' will not list stopped containers.
4fill in blank
hard

Fill both blanks to remove all running containers.

Docker
docker container rm [1] $(docker ps -a -q [2])
Drag options to blanks, or click blank then click option'
A-f
B--filter status=exited
C--filter status=running
D-a
Attempts:
3 left
💡 Hint
Common Mistakes
Not using -f will cause errors when removing running containers.
Filtering by exited will not select running containers.
5fill in blank
hard

Fill all three blanks to remove containers with names starting with 'web' that are stopped.

Docker
docker container rm $(docker ps -a -q [1] [2]=[3])
Drag options to blanks, or click blank then click option'
A--filter
Bname
Cweb
Dstatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'status' instead of 'name' will filter by container state, not name.
Not using '--filter' will cause syntax errors.