Free Docker Certified Associate Trivia Questions and Answers — Questions and Answers
Question 1: If the docker engine does not serve as a manager node for the docker swarm, how may overlay networks be created?
- False
- True (Correct answer)
Correct answer: True
In the event that the docker engine is a component of a swarm, overlay networks may exist. Therefore, being a manager node in a swarm is a requirement for creating an overlay network. <br> The following problem occurs when we attempt to create overlay networks from a non-manager node: <br> <p>ubuntu@ip-10-0-1-11:~$ docker network create -d overlay test-network</p> <br> Daemon error message: Unable to build a multi-host network from a worker node. Please build the network starting with a manager node.
Question 2: Which of the subsequent claims is true? Select exactly two statements.
- Only one container can be spawned from a given image at a time
- Image is a collection of immutable layers whereas container is a running instance of an image. (Correct answer)
- If multiple containers are spawned from the same image then they all use the same copy of image in memory. (Correct answer)
- Container can exist without the image but image cannot exist without container
Correct answer: Image is a collection of immutable layers whereas container is a running instance of an image.
There are immutable layers in an image. A container is a live copy of an image. <br> When several containers are launched from a single picture, only one copy of the image is stored in memory. In order to handle its local modifications, each container has a separate Read and Write layer.
Question 3: Which of the following parameters would allow you to SSH into an active "nginx" Docker container?
- docker run -it nginx /bin/sh
- docker exec -it nginx /bin/sh (Correct answer)
- docker ssh -it nginx /bin/sh
- docker inspect webserver
Correct answer: docker exec -it nginx /bin/sh
"docker exec -it nginx /bin/sh" will construct a TTY-equipped interactive session that is tied to the STDIN.
Question 4: On AWS, you are creating a brand-new Docker Swarm. You must make sure that neither the Security Group Rules nor the Network Access Control List are blocking traffic between hosts. Which of the following statements accurately describes every port that needs to be open between Docker hosts?
- TCP/7946 and UDP/2377
- TCP/2377, TCP/7946, and UDP/7946 (Correct answer)
- TCP/2377 and TCP/4789
- TCP/2377 and UDP/2377
Correct answer: TCP/2377, TCP/7946, and UDP/7946
<li><strong>TCP port 2377</strong> for cluster management communications</li> <li><strong>TCP</strong> and <strong>UDP port 7946</strong> for communication among nodes
Question 5: Which of the commands can be used to view an IPv4 network's subnet?
- docker info network
- docker network inspect (Correct answer)
- docker network is
- docker network info
Correct answer: docker network inspect
"docker network inspect" is an authorized command to examine a certain network
Question 6: How can John launch a container that utilizes the json-file log driver when he has configured his Docker daemon to use the syslog log driver by default?
- By using “--logger json-file” along with docker run
- By using “--log-opt json-file” along with docker run
- By using “--log-driver json-file” along with docker run (Correct answer)
- None of the above
Correct answer: By using “--log-driver json-file” along with docker run
The correct flag is `--log-driver`, so `docker run --log-driver json-file` overrides the daemon's default syslog driver for that single container. `--logger` is not a valid option, and `--log-opt` only sets driver-specific options (key=value pairs), not the driver itself.
Question 7: What commands are valid to run global services in Docker swarm?
- docker service create --global
- docker service create --mode global (Correct answer)
- docker swarm create --global
- docker swarm create --mode global
Correct answer: docker service create --mode global
Global services are created with `docker service create --mode global`, which runs one task on every node in the swarm. There is no `--global` flag, and `docker swarm create` is not a valid command—swarm is initialized with `docker swarm init`, while services are managed with `docker service`.
If the docker engine does not serve as a manager node for the docker swarm, how may overlay networks be created?