MCQs Questions on Advanced Docker Concepts | Docker Multiple Choice Questions

Enhance your expertise with these Docker MCQ questions and answers, covering advanced Docker concepts. Learn about Docker security best practices, resource limiting, managing secrets and configs, custom networks, DNS, and debugging containers. Ideal for Docker professionals and enthusiasts preparing for interviews or aiming to deepen their Docker knowledge.


Security Best Practices for Docker

  1. Which command is used to scan Docker images for vulnerabilities?
    a) docker scan
    b) docker inspect
    c) docker secure
    d) docker protect
  2. What is the best practice for running containers securely?
    a) Run containers as root
    b) Always update Docker images
    c) Limit container privileges
    d) Disable SELinux
  3. How can you prevent sensitive data from being stored in Docker images?
    a) Use environment variables
    b) Add secrets directly in Dockerfile
    c) Use encrypted volumes
    d) Avoid using ENTRYPOINT
  4. Docker Content Trust (DCT) is used to:
    a) Encrypt Docker images
    b) Verify the authenticity of images
    c) Manage Docker containers securely
    d) Automate security audits
  5. What is the purpose of enabling AppArmor in Docker?
    a) To encrypt container storage
    b) To enforce mandatory access control
    c) To optimize resource usage
    d) To enable DNS resolution

Resource Limiting (Memory, CPU)

  1. Which flag is used to limit memory usage for a container?
    a) –cpu-shares
    b) –memory
    c) –mem-limit
    d) –limit-memory
  2. To restrict CPU usage for a Docker container, which flag is used?
    a) –cpu-percent
    b) –cpu-cores
    c) –cpu-quota
    d) –limit-cpu
  3. Docker Swarm manages resource limits using:
    a) Dockerfiles
    b) Stack configuration
    c) Resource pools
    d) YAML files
  4. What happens if a container exceeds its memory limit?
    a) It crashes immediately
    b) It swaps to disk
    c) It is throttled
    d) It is terminated
  5. Which Docker command is used to check resource usage of running containers?
    a) docker inspect
    b) docker stats
    c) docker usage
    d) docker monitor

Managing Secrets and Configs

  1. Docker secrets are used for:
    a) Storing sensitive data securely
    b) Monitoring Docker logs
    c) Configuring custom networks
    d) Limiting resource usage
  2. Which command is used to create a secret in Docker Swarm?
    a) docker swarm secret add
    b) docker secret create
    c) docker secret add
    d) docker swarm create-secret
  3. Secrets in Docker Swarm are:
    a) Stored in plain text
    b) Encrypted at rest
    c) Visible to all containers
    d) Configurable only via CLI
  4. Docker configs differ from secrets because:
    a) Configs are always encrypted
    b) Configs are meant for sensitive data only
    c) Configs are used for non-sensitive configuration data
    d) Configs cannot be version-controlled
  5. To update a secret in Docker, you must:
    a) Modify it directly in the container
    b) Remove and recreate the secret
    c) Use docker secret update
    d) Restart the Docker daemon

Custom Networks and DNS

  1. Which command creates a custom bridge network in Docker?
    a) docker network create bridge
    b) docker network create custom
    c) docker network create –driver bridge
    d) docker network bridge create
  2. What is the default DNS server used by Docker containers?
    a) 8.8.8.8
    b) Host machine’s DNS
    c) Docker’s internal DNS
    d) A randomly assigned DNS
  3. To assign a static IP to a container, you need to:
    a) Use a custom bridge network
    b) Modify the Dockerfile
    c) Configure container ports
    d) Use the default bridge network
  4. In a Docker overlay network, containers:
    a) Can communicate across different hosts
    b) Must run on the same host
    c) Require external DNS configuration
    d) Cannot access other containers
  5. Which flag enables DNS resolution when starting a container?
    a) –dns
    b) –network-dns
    c) –resolve
    d) –host-dns

Debugging and Monitoring Docker Containers

  1. Which command displays the logs of a running Docker container?
    a) docker inspect logs
    b) docker logs
    c) docker events logs
    d) docker container logs
  2. Docker’s built-in tool for monitoring container resource usage is:
    a) docker monitor
    b) docker stats
    c) docker usage
    d) docker inspect
  3. To debug a running container, which of the following can you use?
    a) docker debug-container
    b) docker exec
    c) docker shell-debug
    d) docker attach
  4. Which command helps troubleshoot network issues in Docker?
    a) docker network inspect
    b) docker diagnose
    c) docker net-debug
    d) docker trace-network
  5. When a container fails to start, which log file should you check first?
    a) Dockerfile.log
    b) daemon.log
    c) container.log
    d) docker-engine.log

Advanced Query Features

  1. Which of the following is not a monitoring tool for Docker?
    a) Prometheus
    b) Grafana
    c) Docker Compose
    d) cAdvisor
  2. The --entrypoint flag is used to:
    a) Modify resource limits
    b) Specify the command executed by the container
    c) Set custom DNS servers
    d) Create a new secret
  3. Which command displays detailed information about a container’s configuration?
    a) docker config inspect
    b) docker container inspect
    c) docker details
    d) docker stats
  4. Docker monitoring tools like Prometheus use which mechanism to collect data?
    a) Logs
    b) Metrics scraping
    c) SNMP
    d) Network traces
  5. To capture a snapshot of a running container’s filesystem, you can use:
    a) docker snapshot create
    b) docker commit
    c) docker save
    d) docker export

Answer Key

QNoAnswer (Option with Text)
1a) docker scan
2c) Limit container privileges
3a) Use environment variables
4b) Verify the authenticity of images
5b) To enforce mandatory access control
6b) –memory
7c) –cpu-quota
8b) Stack configuration
9d) It is terminated
10b) docker stats
11a) Storing sensitive data securely
12b) docker secret create
13b) Encrypted at rest
14c) Configs are used for non-sensitive configuration data
15b) Remove and recreate the secret
16c) docker network create –driver bridge
17c) Docker’s internal DNS
18a) Use a custom bridge network
19a) Can communicate across different hosts
20a) –dns
21b) docker logs
22b) docker stats
23b) docker exec
24a) docker network inspect
25b) daemon.log
26c) Docker Compose
27b) Specify the command executed by the container
28b) docker container inspect
29b) Metrics scraping
30b) docker commit

Use a Blank Sheet, Note your Answers and Finally tally with our answer at last. Give Yourself Score.

X
error: Content is protected !!
Scroll to Top