Docker MCQs – Docker Networking

21.) What is the main use case for the –link flag in Docker?

A) Connecting containers on different networks
B) Creating a new network
C) Connecting containers for legacy applications
D) Encrypting container communication

Answer: Option C

Explanation: The –link flag connects containers, primarily used in older Docker versions (now deprecated).

22.) How do you remove a Docker network?

A) docker network delete <network>
B) docker network rm <network>
C) docker network remove <network>
D) docker rm –network <network>

Answer: Option B

Explanation: The docker network rm command removes a Docker network.

23.) What is the default network mode for Docker Compose services?

A) Host
B) None
C) Bridge
D) Overlay

Answer: Option C

Explanation: The default network mode for Docker Compose services is bridge.

24.) What is the role of –internal in Docker networks?

A) It prevents external access to the network.
B) It enables encrypted communication.
C) It connects containers across hosts.
D) It allows containers to bypass the DNS.

Answer: Option A

Explanation: The –internal option prevents external access to the network, creating an isolated internal network.

25.) How do you enable encrypted communication in an overlay network?

A) –secure
B) –encrypted
C) –driver overlay –opt encrypted
D) –tls

Answer: Option C

Explanation: The –opt encrypted option enables encrypted communication in an overlay network.

Leave a Reply

Your email address will not be published. Required fields are marked *