Q. Which command is used to view the Docker container's mounted volumes?

  • (A) docker inspect
  • (B) docker volume ls
  • (C) docker logs
  • (D) docker top
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker inspect
Explanation: The 'docker inspect' command provides detailed information about a container, including its mounted volumes.

Q. What is the purpose of the 'docker-compose config --no-interpolate' command?

  • (A) To display the configuration without interpolating environment variables
  • (B) To validate the docker-compose.yml file
  • (C) To display the configuration of services
  • (D) To list all containers
πŸ’¬ Discuss
βœ… Correct Answer: (A) To display the configuration without interpolating environment variables
Explanation: The 'docker-compose config --no-interpolate' command displays the configuration without interpolating environment variables.

Q. Which command is used to view the Docker container's port mappings?

  • (A) docker inspect
  • (B) docker port
  • (C) docker logs
  • (D) docker top
πŸ’¬ Discuss
βœ… Correct Answer: (B) docker port
Explanation: The 'docker port' command displays the port mappings for a specific container. For example, 'docker port <container_id>'.

Q. What is the purpose of the 'docker-compose config --resolve-image-digests' command?

  • (A) To display the configuration with resolved image digests
  • (B) To validate the docker-compose.yml file
  • (C) To display the configuration of services
  • (D) To list all containers
πŸ’¬ Discuss
βœ… Correct Answer: (A) To display the configuration with resolved image digests
Explanation: The 'docker-compose config --resolve-image-digests' command displays the configuration with resolved image digests.

Q. Which command is used to view the Docker container's restart policy?

  • (A) docker inspect
  • (B) docker restart
  • (C) docker logs
  • (D) docker top
πŸ’¬ Discuss
βœ… Correct Answer: (A) docker inspect
Explanation: The 'docker inspect' command provides detailed information about a container, including its restart policy.

Q. Which of the following is used to give a container access to a specific port?

  • (A) docker expose container_name
  • (B) docker map port container_name
  • (C) docker run -p host_port:container_port
  • (D) docker connect port container_name
πŸ’¬ Discuss
βœ… Correct Answer: (C) docker run -p host_port:container_port
Explanation: 'docker run -p host_port:container_port' is used to bind a container's internal port to a port on the host system.

Q. Which of the following options is correct regarding Docker layers?

  • (A) Each instruction in a Dockerfile creates a new layer in the Docker image
  • (B) Docker images cannot have layers
  • (C) Docker layers are temporary and discarded after the image is built
  • (D) Docker layers are used to manage the runtime of containers
πŸ’¬ Discuss
βœ… Correct Answer: (A) Each instruction in a Dockerfile creates a new layer in the Docker image
Explanation: Each instruction in a Dockerfile (e.g., RUN, COPY, etc.) creates a new layer in the Docker image, which helps in reusability and caching.

Q. Which of the following commands can be used to list the running Docker containers?

  • (A) docker list
  • (B) docker ps
  • (C) docker show containers
  • (D) docker container status
πŸ’¬ Discuss
βœ… Correct Answer: (B) docker ps
Explanation: 'docker ps' is used to list all running Docker containers.

Q. Which of the following is true about Docker Swarm?

  • (A) Docker Swarm is a tool for managing multi-container applications in a single host
  • (B) Docker Swarm is used for orchestrating Docker containers across a cluster of machines
  • (C) Docker Swarm only works in Docker Desktop environments
  • (D) Docker Swarm does not support container scaling
πŸ’¬ Discuss
βœ… Correct Answer: (B) Docker Swarm is used for orchestrating Docker containers across a cluster of machines
Explanation: Docker Swarm is a native Docker orchestration tool that allows the management of Docker containers across a cluster of machines.

Q. Which of the following Docker commands is used to remove unused images?

  • (A) docker clean -a
  • (B) docker rmi unused
  • (C) docker image prune
  • (D) docker remove image
πŸ’¬ Discuss
βœ… Correct Answer: (C) docker image prune
Explanation: 'docker image prune' is used to remove unused Docker images.