Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the command to list all running Docker containers.
Docker
docker [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'docker run' instead of 'docker ps' to list containers.
Using 'docker images' which lists images, not containers.
✗ Incorrect
The docker ps command shows all running containers.
2fill in blank
mediumComplete the command to remove a Docker container by its ID.
Docker
docker [1] container_id Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'docker stop' which only stops but does not remove containers.
Using 'docker exec' which runs commands inside containers.
✗ Incorrect
The docker rm command removes a container by its ID.
3fill in blank
hardFix the error in the command to build a Docker image from a Dockerfile.
Docker
docker build -t [1] . Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-f' after '-t' which is incorrect here.
Using 'run' or 'container' which are not valid image names.
✗ Incorrect
The -t option tags the image with a name like my_image.
4fill in blank
hardFill both blanks to create a Docker container with a specific name and run it in detached mode.
Docker
docker run -d --name [1] [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting image name in the container name blank.
Using port mapping instead of image name.
✗ Incorrect
my_container is the container name, and nginx is the image to run.
5fill in blank
hardFill all three blanks to write a Dockerfile snippet that sets the base image, copies files, and runs a command.
Docker
FROM [1] COPY . /app CMD ["[2]", "[3]"]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'nginx' as base image for a Python app.
Swapping command and script names.
✗ Incorrect
The base image is python:3.12-slim, the command is python, and the script to run is app.py.