Bird
Raised Fist0
Dockerdevops~20 mins

What is Docker - Practice Questions & Exercises

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Docker Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the primary purpose of Docker?

Docker is a popular tool in DevOps. What is its main purpose?

ATo create isolated environments called containers to run applications consistently.
BTo manage virtual machines with heavy resource usage.
CTo monitor network traffic between servers.
DTo write code in multiple programming languages.
Attempts:
2 left
💡 Hint

Think about how Docker helps developers run apps the same way everywhere.

💻 Command Output
intermediate
1:30remaining
What is the output of 'docker ps' command?

After running docker ps on a system with two running containers, what will you see?

Docker
docker ps
AA list showing details of all running containers including container ID, image, status, and ports.
BA list of all images downloaded on the system.
CA list of all stopped containers only.
DAn error saying 'command not found'.
Attempts:
2 left
💡 Hint

Remember, docker ps shows running containers, not images or stopped containers.

❓ Configuration
advanced
2:00remaining
Which Dockerfile instruction sets the base image?

In a Dockerfile, which instruction is used to specify the base image for your container?

Docker
Dockerfile snippet
ACMD python app.py
BRUN apt-get update
CCOPY . /app
DFROM ubuntu:20.04
Attempts:
2 left
💡 Hint

The base image is the starting point for your container's environment.

🔀 Workflow
advanced
2:30remaining
What is the correct order to build and run a Docker container?

Arrange these steps in the correct order to build and run a Docker container from a Dockerfile.

A3,2,1,4
B3,1,2,4
C1,3,2,4
D2,1,3,4
Attempts:
2 left
💡 Hint

First create the Dockerfile, then build the image, run the container, and finally check it.

❓ Troubleshoot
expert
2:00remaining
What error occurs if Docker daemon is not running when executing 'docker ps'?

You run docker ps but get an error. What is the most likely error message if the Docker daemon is not running?

AError: No such container found.
BSyntax error near unexpected token 'ps'.
CCannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
DPermission denied while accessing Dockerfile.
Attempts:
2 left
💡 Hint

Think about what happens if the Docker service is stopped but you try to use Docker commands.

Practice

(1/5)
1. What is the main purpose of Docker?
easy
A. To write code faster using a new programming language
B. To package applications into containers that run consistently everywhere
C. To replace operating systems on servers
D. To create virtual machines for running multiple OS

Solution

  1. Step 1: Understand Docker's core function

    Docker packages applications and their dependencies into containers.
  2. Step 2: Compare with other options

    The other options describe unrelated technologies or incorrect uses.
  3. Final Answer:

    To package applications into containers that run consistently everywhere -> Option B
  4. Quick Check:

    Docker = container packaging [OK]
Hint: Docker = app in container for consistent runs [OK]
Common Mistakes:
  • Confusing Docker with a programming language
  • Thinking Docker replaces the OS
  • Mixing Docker with virtual machines
2. Which of the following is the correct command to check the installed Docker version?
easy
A. docker version
B. docker check
C. docker --install
D. docker status

Solution

  1. Step 1: Recall Docker commands

    The command to check Docker version is docker version.
  2. Step 2: Validate other options

    Commands like docker check, docker --install, and docker status are invalid or do not show version.
  3. Final Answer:

    docker version -> Option A
  4. Quick Check:

    Check version = docker version [OK]
Hint: Use 'docker version' to see Docker's installed version [OK]
Common Mistakes:
  • Using 'docker check' which is not a valid command
  • Trying 'docker status' to check version
  • Confusing install commands with version check
3. What will be the output of the command docker ps if no containers are running?
medium
A. Displays an empty table with headers but no container entries
B. Shows an error message 'No containers found'
C. Lists all running containers
D. Starts a new container automatically

Solution

  1. Step 1: Understand 'docker ps' behavior

    The command docker ps lists running containers. If none are running, it shows headers but no container rows.
  2. Step 2: Check other options

    It does not show an error or start containers automatically.
  3. Final Answer:

    Displays an empty table with headers but no container entries -> Option A
  4. Quick Check:

    docker ps empty = headers only [OK]
Hint: 'docker ps' shows running containers or empty headers if none [OK]
Common Mistakes:
  • Expecting an error message when no containers run
  • Thinking it starts containers automatically
  • Confusing 'docker ps' with 'docker images'
4. You run docker run hello-world but get an error saying the image is not found locally. What should you do to fix this?
medium
A. Delete all containers and try again
B. Reinstall Docker completely
C. Run docker pull hello-world to download the image first
D. Change the command to docker start hello-world

Solution

  1. Step 1: Understand the error cause

    The error means the image 'hello-world' is not on your machine.
  2. Step 2: Fix by downloading the image

    Use docker pull hello-world to get the image from Docker Hub.
  3. Final Answer:

    Run docker pull hello-world to download the image first -> Option C
  4. Quick Check:

    Image missing? Use docker pull [OK]
Hint: Pull missing images before running containers [OK]
Common Mistakes:
  • Trying to start a container without the image
  • Reinstalling Docker unnecessarily
  • Deleting containers unrelated to the image issue
5. Which of the following best explains why Docker containers help teams work faster and more reliably?
hard
A. Containers automatically fix bugs in the application code
B. Containers run only on the developer's local machine
C. Containers replace the need for any testing before deployment
D. Containers isolate apps and dependencies, avoiding setup conflicts across environments

Solution

  1. Step 1: Understand container benefits

    Docker containers package apps with all needed parts, so they run the same everywhere.
  2. Step 2: Evaluate options

    Containers isolate apps and dependencies, avoiding setup conflicts across environments correctly states isolation and consistency. The other options are false or misleading.
  3. Final Answer:

    Containers isolate apps and dependencies, avoiding setup conflicts across environments -> Option D
  4. Quick Check:

    Isolation + consistency = faster, reliable work [OK]
Hint: Containers isolate apps to avoid environment issues [OK]
Common Mistakes:
  • Believing containers fix code bugs automatically
  • Skipping testing because of containers
  • Thinking containers only run locally
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard