Docker Certified Associate (DCA) Exam Questions with Answers
Section 1: Docker Basics (20 Questions)
Q1. What is Docker?
A. A platform to build, ship, and run applications in containers.
Q2. What command checks Docker version?
A. docker version
Q3. Default Docker client-server communication protocol?
A. REST API over UNIX socket or TCP.
Q4. Default Docker daemon port?
A. 2375 (unsecured), 2376 (secured).
Q5. What is a container?
A. A lightweight isolated environment running an application.
Q6. What is the Docker Engine?
A. The runtime that builds and runs containers.
Q7. Command to list running containers?
A. docker ps
Q8. Command to list all containers?
A. docker ps -a
Q9. Command to stop a container?
A. docker stop <container_id>
Q10. Command to start a stopped container?
A. docker start <container_id>
Q11. Command to remove container?
A. docker rm <container_id>
Q12. Command to remove all stopped containers?
A. docker container prune
Q13. Command to check Docker system info?
A. docker info
Q14. Default storage driver in most Linux distros?
A. overlay2
Q15. Command to pull image from Docker Hub?
A. docker pull <image>
Q16. Command to run image interactively?
A. docker run -it <image> bash
Q17. Command to run container in detached mode?
A. docker run -d <image>
Q18. Command to rename container?
A. docker rename old new
Q19. Command to inspect container details?
A. docker inspect <container>
Q20. Command to view logs?
A. docker logs <container>
Section 2: Image Creation, Management & Registry (20 Questions)
Q21. Command to list all images?
A. docker images
Q22. Command to remove image?
A. docker rmi <image_id>
Q23. Command to build image?
A. docker build -t <tag> .
Q24. Default image registry for Docker?
A. Docker Hub
Q25. Command to tag an image?
A. docker tag <src> <repo>:<tag>
Q26. Command to push image to registry?
A. docker push <repo>:<tag>
Q27. Command to login to Docker Hub?
A. docker login
Q28. Command to logout?
A. docker logout
Q29. Default base directory for images?
A. /var/lib/docker
Q30. What file defines custom image build instructions?
A. Dockerfile
Q31. Command to show image history?
A. docker history <image>
Q32. Command to save image as tar file?
A. docker save -o image.tar <image>
Q33. Command to load image from tar file?
A. docker load -i image.tar
Q34. Command to export container filesystem?
A. docker export <container> > file.tar
Q35. Command to import tar file as image?
A. docker import file.tar
Q36. Dockerfile instruction to specify base image?
A. FROM
Q37. Instruction to copy files?
A. COPY
Q38. Instruction to execute commands during build?
A. RUN
Q39. Instruction to set environment variable?
A. ENV
Q40. Instruction to specify default command?
A. CMD
Section 3: Networking & Storage (20 Questions)
Q41. Command to list networks?
A. docker network ls
Q42. Default Docker network type?
A. bridge
Q43. Command to inspect network?
A. docker network inspect <network>
Q44. Command to connect container to network?
A. docker network connect <network> <container>
Q45. Command to disconnect container?
A. docker network disconnect <network> <container>
Q46. Default IP subnet for bridge network?
A. 172.17.0.0/16
Q47. Command to create custom network?
A. docker network create <name>
Q48. Which driver supports multi-host networking?
A. overlay
Q49. What is host network mode?
A. Shares host network stack with container.
Q50. Command to mount volume?
A. docker run -v <host_path>:<container_path>
Q51. Command to list volumes?
A. docker volume ls
Q52. Command to inspect volume?
A. docker volume inspect <name>
Q53. Command to remove volume?
A. docker volume rm <name>
Q54. Command to prune unused volumes?
A. docker volume prune
Q55. Default volume location?
A. /var/lib/docker/volumes
Q56. Two types of mounts in Docker?
A. Bind mount, Volume
Q57. What happens when container is deleted (with volume)?
A. Volume persists unless manually removed.
Q58. Command to create volume explicitly?
A. docker volume create <name>
Q59. Volume advantage?
A. Data persists beyond container lifecycle.
Q60. Default volume driver?
A. local
Section 4: Orchestration (Docker Swarm) (20 Questions)
Q61. Command to initialize a swarm?
A. docker swarm init
Q62. Command to join swarm as worker?
A. docker swarm join
Q63. Command to list swarm nodes?
A. docker node ls
Q64. Command to inspect node details?
A. docker node inspect <node>
Q65. Command to deploy a stack?
A. docker stack deploy -c docker-compose.yml <stack_name>
Q66. Command to list stacks?
A. docker stack ls
Q67. Command to list services in a stack?
A. docker stack services <stack>
Q68. Command to create a service?
A. docker service create --name web nginx
Q69. Command to scale service replicas?
A. docker service scale web=5
Q70. Command to list all services?
A. docker service ls
Q71. Command to remove service?
A. docker service rm <service>
Q72. Command to inspect a service?
A. docker service inspect <service>
Q73. Command to update service image?
A. docker service update --image <new_image> <service>
Q74. Command to drain a node?
A. docker node update --availability drain <node>
Q75. Default overlay network for swarm ingress?
A. ingress
Q76. Command to show tasks of service?
A. docker service ps <service>
Q77. Command for a node to leave swarm?
A. docker swarm leave
Q78. Recommended number of manager nodes?
A. Odd number (e.g., 3 or 5).
Q79. Swarm consensus algorithm used?
A. Raft
Q80. Command to promote worker to manager?
A. docker node promote <node>
Section 5: Security, Monitoring & Troubleshooting (20 Questions)
Q81. Command to view Docker logs?
A. docker logs <container>
Q82. Command to check running processes in container?
A. docker top <container>
Q83. Command to access container shell?
A. docker exec -it <container> bash
Q84. Dockerfile instruction to change user?
A. USER
Q85. Dockerfile instruction for working directory?
A. WORKDIR
Q86. Command to view Docker daemon logs (systemd)?
A. journalctl -u docker
Q87. Enable Docker Content Trust?
A. export DOCKER_CONTENT_TRUST=1
Q88. Command to check image digest?
A. docker inspect --format='{{index .RepoDigests 0}}' <image>
Q89. Default seccomp profile used by Docker?
A. default.json
Q90. Docker isolation mechanism on Linux?
A. Namespaces + cgroups
Q91. Command to check disk usage by Docker?
A. docker system df
Q92. Command to remove unused resources?
A. docker system prune
Q93. Command to limit container memory?
A. docker run -m 512m <image>
Q94. Command to limit CPU usage?
A. docker run --cpus=1 <image>
Q95. Docker daemon configuration file path?
A. /etc/docker/daemon.json
Q96. Command to restart Docker service?
A. systemctl restart docker
Q97. Command to monitor real-time events?
A. docker events
Q98. Command to check container health status?
A. docker inspect --format '{{.State.Health.Status}}' <container>
Q99. Default logging driver?
A. json-file
Q100. Command to change log driver globally?
A. Edit /etc/docker/daemon.json
Section 6: Scenario-Based & Command Mix (20 Questions)
Q101. Run container and auto-remove on exit?
A. docker run --rm <image>
Q102. Run container mapping host port 8080 to container port 80?
A. docker run -p 8080:80 <image>
Q103. Execute command inside running container?
A. docker exec <container> <command>
Q104. Copy file from container to host?
A. docker cp <container>:/path /hostpath
Q105. Copy file from host to container?
A. docker cp /path <container>:/dest
Q106. Create container with environment variable?
A. docker run -e VAR=value <image>
Q107. Build image using specific Dockerfile?
A. docker build -f Dockerfile.custom -t app .
Q108. List container resource usage?
A. docker stats
Q109. Restart all running containers?
A. docker restart $(docker ps -q)
Q110. Check Docker daemon service status?
A. systemctl status docker
Q111. Remove all containers, images, and volumes?
A. docker system prune -a --volumes
Q112. Save container state as a new image?
A. docker commit <container> <image>
Q113. Run container with custom name?
A. docker run --name myapp <image>
Q114. Pause and resume container?
A. docker pause <container> / docker unpause <container>
Q115. Check Docker Compose version?
A. docker compose version
Q116. Start services from docker-compose.yml?
A. docker compose up -d
Q117. Stop and remove Compose services?
A. docker compose down
Q118. Get container IP address?
A. docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container>
Q119. Backup all Docker images to tar?
A. docker save $(docker images -q) -o allimages.tar
Q120. Restore all images from tar?
A. docker load -i allimages.tar
