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 'images' instead of 'ps' to list containers.
✗ Incorrect
The docker ps command lists all running containers.
2fill in blank
mediumComplete the command to start a new container from the nginx image.
Docker
docker [1] nginx Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'build' instead of 'run' to start a container.
✗ Incorrect
The docker run command starts a new container from an image.
3fill in blank
hardFix the error in the command to stop a container named myapp.
Docker
docker [1] myapp Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'start' instead of 'stop' to halt a container.
✗ Incorrect
The docker stop command stops a running container.
4fill in blank
hardFill both blanks to create a Dockerfile that uses Ubuntu and installs curl.
Docker
FROM [1] RUN apt-get update && apt-get install -y [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'nginx' as base image or installing 'node' instead of 'curl'.
✗ Incorrect
The base image is ubuntu and the package to install is curl.
5fill in blank
hardFill all three blanks to create a Docker command that runs a container in detached mode, names it webserver, and maps port 8080 to 80.
Docker
docker run [1] --name [2] -p [3]:80 nginx
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-it' instead of '-d' for detached mode.
Wrong port mapping syntax.
✗ Incorrect
Use -d for detached mode, name the container webserver, and map port 8080 on the host to port 80 in the container.