Courseiva

CCNA Networking And Compose Questions

52 questions · Networking And Compose · All types, answers revealed

1
MCQeasy

How do you disconnect a running container from a custom network named 'mynet'?

A.podman container disconnect mynet mycontainer
B.podman network disconnect mynet mycontainer
C.podman network remove mynet mycontainer
D.podman network detach mynet mycontainer
AnswerB

Disconnects the container from the network.

Why this answer

'podman network disconnect' removes a container from a specified network.

2
MCQhard

You need to inspect the configuration details, including subnet, gateway, and driver, of a custom Podman network named 'appnet'. Which command should you run?

A.podman inspect --network appnet
B.podman network show appnet
C.podman network status appnet
D.podman network inspect appnet
AnswerD

This command shows detailed JSON configuration for the network.

Why this answer

'podman network inspect' displays detailed low-level network configurations in JSON format.

3
MCQhard

An administrator needs to connect an already running container named 'web1' to an existing user-defined network named 'backend-net' without restarting the container. Which command accomplishes this?

A.podman network attach backend-net web1
B.podman network connect backend-net web1
C.podman container modify --network backend-net web1
D.podman network join --container web1 backend-net
AnswerB

Correct. This command connects an active container to a specified network.

Why this answer

The 'podman network connect' command attaches a running container to an additional network interface.

4
MCQeasy

A container needs to be created that shares the host's network stack entirely, bypassing any NAT or virtual interface overhead. Which Podman flag achieves this?

A.--share-net
B.--publish host
C.--network host
D.--net bridge
AnswerC

This places the container on the host network stack.

Why this answer

Using --network host disables network isolation and places the container directly on the host's network namespace.

5
MCQhard

When inspecting the networking of a container using 'podman inspect', where is the IP address of the container located in the output JSON structure?

A.NetworkSettings.IPAddress
B.HostConfig.PortBindings.IP
C.Config.Network.IP
D.State.Networking.Address
AnswerA

Contains the primary IP address in the container inspection output.

Why this answer

The NetworkSettings.IPAddress field contains the IPv4 address assigned to the container on its default network.

6
MCQeasy

Which environment file option can be used in a Podman Compose file to automatically load environment variables for service configuration?

A.environment_source
B.variables_file
C.env_file
D.load_env
AnswerC

Loads environment variables from a file.

Why this answer

The 'env_file' directive allows passing a .env file into containers or using them for interpolation.

7
MCQeasy

Which flag allows you to publish a container port to a random ephemeral port on the host interface?

A.-p random
B.-p 0:8080
C.--port dynamic
D.-P
AnswerD

Publishes all exposed ports to random host ports.

Why this answer

Using -P or --publish-all publishes all exposed ports to random high-numbered ports on the host.

8
MCQmedium

You wish to connect an already running container to an existing custom Podman network named 'mynet'. Which command should you use?

A.podman network attach mynet mycontainer
B.podman container network-add mynet mycontainer
C.podman network connect mynet mycontainer
D.podman network join mynet mycontainer
AnswerC

Connects the specified container to the network.

Why this answer

'podman network connect' attaches a running or stopped container to a specified network.

9
Multi-Selecthard

When working with Podman Compose files, which TWO options are valid keys that can be specified under a service definition for port and networking configuration? (Choose two)

Select 2 answers
A.firewall
B.networks
C.nat_mapping
D.ports
E.ip_address
AnswersB, D

Correct. 'networks' connects the service to specified Compose networks.

Why this answer

In Compose files, 'ports' defines port mappings to the host, and 'networks' assigns the service to specific custom networks.

10
MCQmedium

You are writing a Podman Compose file and want to ensure a service depends on another service being fully started before it initializes. Which directive should you use?

A.depends_on
B.requires
C.wait_for
D.links_to
AnswerA

Specifies service startup dependencies.

Why this answer

The 'depends_on' directive controls startup order of services in compose files.

11
MCQeasy

A containerized web service must be accessible from the host system on TCP port 8080, while the application inside the container listens on port 80. Which flag correctly configures this port mapping?

A.--expose 8080:80
B.-p 80:8080
C.-p 8080:80
D.--port-map 8080=80
AnswerC

Correct. Host port 8080 is mapped to container port 80.

Why this answer

The format for the --publish or -p flag is host_port:container_port. Thus, -p 8080:80 maps host port 8080 to container port 80.

12
MCQhard

An administrator creates a custom CNI network using 'podman network create mynet' and wants to assign a static IP address to a container upon creation. Which option achieves this?

A.podman run --network mynet:192.168.100.50 -d myimage
B.podman run --network mynet --ip 192.168.100.50 -d myimage
C.podman network connect --ip 192.168.100.50 mynet container_id
D.podman run --net-static-ip 192.168.100.50 -d myimage
AnswerB

--ip assigns a static IP on custom bridge networks.

Why this answer

The --ip flag is used with 'podman run' on a user-defined bridge network to allocate a specific static IP address to the container interface.

13
MCQeasy

Which command starts services defined in a Podman Compose file in detached mode?

A.podman-compose background
B.podman-compose start --detach
C.podman-compose up -d
D.podman-compose run -d
AnswerC

Starts containers defined in the compose file in the background.

Why this answer

'podman-compose up -d' or 'podman compose up -d' starts all containers in background/detached mode.

14
MCQeasy

An administrator needs to run a container that shares the host's network namespace directly so it can listen on privileged ports without port forwarding. Which Podman command flag achieves this network mode?

A.--network host
B.--network bridge
C.--publish-all
D.--net=none
AnswerA

Correct. Using --network host shares the host network stack directly.

Why this answer

The --net=host or --network host flag causes the container to run in the host's network namespace, giving it direct access to the host network interfaces and ports.

15
MCQeasy

Which configuration block in a Podman Compose YAML file is used to define custom isolated networks for the multi-container application?

A.interfaces:
B.bridges:
C.networks:
D.connections:
AnswerC

Correct. The top-level 'networks' key defines custom networks.

Why this answer

At the root level of a Compose file, the 'networks:' top-level element defines custom networks that services can attach to.

16
Multi-Selecthard

Which THREE actions occur when a container is executed with the --network none flag? (Choose three)

Select 3 answers
A.No default gateway is configured in the container's routing table.
B.The container automatically shares the host's physical network card.
C.The container is assigned a private IP address on the default bridge.
D.Only the loopback (lo) interface is created inside the container.
E.Port publishing flags (-p) are ignored or fail when starting the container.
AnswersA, D, E

Correct. Without external interfaces, there is no default gateway.

Why this answer

Using --network none results in no external network interfaces except loopback, no default gateway, and no external IP address assigned.

17
MCQmedium

Two containers running on the same custom user-defined bridge network need to communicate with each other. What built-in mechanism allows them to resolve each other by container name?

A.Automatic DNS resolution provided by the CNI/Netavark network backend
B.Static ARP table broadcasting managed by the kernel
C.Multicast DNS (mDNS) running inside every container image by default
D.Automatic editing of the host's /etc/hosts file by the Podman daemon
AnswerA

Correct. Custom networks enable built-in DNS name resolution between containers.

Why this answer

User-defined bridge networks in Podman (backed by CNI or Netavark) provide automatic internal container name resolution through embedded DNS services.

18
MCQmedium

Two containers running on the same custom user-defined bridge network need to communicate using container names as hostnames. What is required for this to work natively in Podman?

A.You must use the default 'podman' bridge network.
B.You must edit /etc/hosts inside the containers manually.
C.Nothing extra; user-defined bridge networks include built-in DNS resolution.
D.You must manually link containers using the --link flag.
AnswerC

Custom networks automatically enable DNS name resolution between containers.

Why this answer

User-defined networks in Podman leverage CNI and netavark/aardvark-dns to provide automatic container name resolution out of the box.

19
MCQhard

When utilizing Podman Compose, how are service dependencies and container startup orders typically managed within the YAML structure?

A.By ordering the service keys alphabetically in the YAML file
B.Using the 'links' parameter exclusively
C.Through the 'startup_order' directive
D.Using the 'depends_on' configuration key under the service definition
AnswerD

Correct. 'depends_on' controls the startup order of services.

Why this answer

The 'depends_on' key in a Compose file is used to express startup dependencies between services.

20
MCQeasy

How do you stop and remove containers, networks, and volumes created by a Podman Compose file?

A.podman-compose rm --all
B.podman-compose down
C.podman-compose destroy
D.podman-compose stop --purge
AnswerB

Stops and removes resources defined in the compose file.

Why this answer

'podman-compose down' tears down the entire application stack defined in the compose file.

21
MCQmedium

An administrator needs to inspect the configuration details, including subnet and gateway, of an existing custom network named 'my-net'. Which command should be executed?

A.podman network show my-net
B.podman network details my-net
C.podman network inspect my-net
D.podman inspect network my-net
AnswerC

Correct. This command outputs detailed network metadata.

Why this answer

The 'podman network inspect' command displays detailed configuration JSON for a specified network.

22
MCQeasy

How do you check the logs of all services managed by a Podman Compose file?

A.podman-compose monitor
B.podman-compose logs
C.podman-compose output
D.podman logs --compose
AnswerB

Shows logs for compose services.

Why this answer

'podman-compose logs' displays log output from all services defined in the compose file.

23
MCQhard

When generating a Kubernetes Pod YAML from a Podman container using 'podman generate kubernetes', how are published ports mapped into the resulting Kubernetes manifest?

A.They are translated into container port definitions within the containers spec array.
B.They are converted into host-level iptables rules embedded in annotations.
C.They are ignored entirely and must be added manually.
D.They cause the generation command to fail with a port conflict error.
AnswerA

Podman converts -p flags into container ports in the generated Kubernetes YAML.

Why this answer

Published ports are translated into container ports inside the pod specification and exposed via service/ports specifications depending on options.

24
MCQmedium

You want to create a Podman network with a specific subnet and gateway. Which command correctly specifies these parameters?

A.podman network create --subnet 192.168.200.0/24 --gateway 192.168.200.1 customnet
B.podman network create --ip-range 192.168.200.0/24 customnet
C.podman network new --subnet=192.168.200.0/24 customnet
D.podman network create customnet --network 192.168.200.0/24
AnswerA

--subnet and --gateway configure IPAM for the custom bridge network.

Why this answer

'podman network create --subnet 192.168.200.0/24 --gateway 192.168.200.1 customnet' sets up custom IPAM settings.

25
MCQmedium

An operator runs a Podman container and needs to inspect its assigned IP address directly from the container's runtime inspection output. Which command filters the JSON output to show only the IP address?

A.podman show-ip container_name
B.podman inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name
C.podman network ip container_name
D.podman inspect --ip container_name
AnswerB

Correct. This Go template extracts the IP address from the network settings.

Why this answer

The --format flag with Go templates allows extracting specific fields like network IP addresses from 'podman inspect'.

26
MCQmedium

You need to inspect the network traffic of a container by capturing packets on its virtual interface. Where can you find the host-side veth interface name associated with a running container?

A.It is always named 'eth0' on the host system.
B.In the /etc/resolv.conf file inside the container.
C.In the systemd journal logs exclusively.
D.In the container's network inspection output under network interface details.
AnswerD

Podman inspect exposes interface names assigned to the container.

Why this answer

Inspecting the network settings or container JSON reveals the interface name or network details, or using 'podman inspect' with network settings.

27
MCQmedium

You want to remove a custom Podman network named 'testnet', but it currently has active containers attached to it. What happens?

A.The network is removed, and the containers lose their network interface silently.
B.The deletion fails until all connected containers are stopped and disconnected.
C.The containers are automatically disconnected and moved to the default bridge network.
D.The containers are automatically terminated and the network is removed.
AnswerB

Active containers prevent network removal.

Why this answer

Podman prevents network deletion while active endpoints/containers are connected to ensure integrity.

28
Multi-Selecthard

Which TWO files or backend network management utilities are heavily relied upon by Podman for container networking stack configuration on modern Linux distributions? (Choose two.)

Select 2 answers
A.aardvark-dns
B.libnetwork
C.docker-proxy
D.iptables-nft
E.netavark
AnswersA, E

Aardvark-dns is the DNS server used for container name resolution.

Why this answer

Netavark and aardvark-dns are the modern backend tools used by Podman.

29
Multi-Selecteasy

Which THREE commands are valid Podman subcommands for managing container networks? (Choose three)

Select 3 answers
A.podman network ls
B.podman network create
C.podman network restart
D.podman network upgrade
E.podman network inspect
AnswersA, B, E

Correct. 'ls' lists all available container networks.

Why this answer

Podman provides network management via 'podman network ls', 'podman network inspect', and 'podman network create'.

30
MCQmedium

You need to configure container DNS servers explicitly when running a container, overriding the host's /etc/resolv.conf settings. Which Podman flag do you use?

A.--resolv-conf custom
B.--nameserver 8.8.8.8
C.--dns-search 8.8.8.8
D.--dns 8.8.8.8
AnswerD

Sets custom DNS servers for the container.

Why this answer

The --dns flag specifies custom DNS servers for the container.

31
MCQmedium

An operator wants to create a custom user-defined bridge network named 'app-net' with a specific subnet of '192.168.100.0/24' using Podman. Which command is correct?

A.podman bridge create app-net --subnet 192.168.100.0/24
B.podman network create --subnet 192.168.100.0/24 app-net
C.podman create network --ip 192.168.100.0/24 app-net
D.podman network new --subnet=192.168.100.0/24 app-net
AnswerB

Correct. This command creates a custom bridge network with the specified subnet.

Why this answer

User-defined networks are created with 'podman network create'. The --subnet flag specifies the CIDR block for the network.

32
MCQeasy

How do you list all available Podman networks on your system?

A.podman network ls
B.podman network list
C.podman network status
D.podman network show
AnswerA

Lists all networks.

Why this answer

'podman network ls' lists all configured container networks.

33
MCQhard

You need to configure a container port mapping in Podman Compose so that host port 80 forwards to container port 8080. Which YAML syntax is correct under the service definition?

A.publish: - 80->8080
B.ports: - "80:8080"
C.expose: - "80:8080"
D.ports: container: 8080 host: 80
AnswerB

Standard format for mapping host port to container port.

Why this answer

The 'ports' directive uses strings or lists in 'HOST:CONTAINER' format.

34
MCQmedium

You are deploying a container and want to bind its published port exclusively to the loopback interface (127.0.0.1) on the host to prevent external network access. Which syntax is correct?

A.-p 127.0.0.1:8080:80
B.-p 8080:80@127.0.0.1
C.-p 80:80 --host-ip 127.0.0.1
D.--bind-ip 127.0.0.1 -p 8080:80
AnswerA

Correct. This binds the port exclusively to the local loopback interface.

Why this answer

Podman allows binding ports to a specific host IP using the format ip:host_port:container_port. Therefore, 127.0.0.1:8080:80 accomplishes this.

35
MCQhard

You need to completely remove a custom user-defined bridge network named 'test-net' that has no active containers attached to it. Which command performs this action?

A.podman network prune --force
B.podman network rm test-net
C.podman rm network test-net
D.podman network delete test-net
AnswerB

Correct. 'podman network rm' removes the specified network.

Why this answer

The 'podman network rm' command deletes an existing unused user-defined network.

36
MCQeasy

Which command removes all unused Podman networks that are not currently connected to any containers?

A.podman network prune
B.podman network clean
C.podman network rm --unused
D.podman prune networks
AnswerA

Removes unused networks.

Why this answer

'podman network prune' deletes unused networks.

37
Multi-Selecteasy

When configuring container networking in Podman, which TWO built-in network modes are available by default without creating custom networks? (Choose two)

Select 2 answers
A.bridge
B.host
C.macvlan
D.routed
E.overlay
AnswersA, B

Correct. Bridge is the default network mode for new containers.

Why this answer

Podman provides default network behaviors including 'bridge' (the default NAT network) and 'host' (sharing the host network stack).

38
Multi-Selecthard

When generating Kubernetes YAML using 'podman generate kubernetes', which TWO object types can be targeted or generated by the command? (Choose two.)

Select 2 answers
A.Deployment
B.DaemonSet
C.Pod
D.StatefulSet
E.Ingress
AnswersA, C

Can generate a Kubernetes Deployment manifest.

Why this answer

Podman can generate Kubernetes Pod and Deployment manifests.

39
MCQeasy

You are troubleshooting a container that should have no network access whatsoever for security isolation. Which networking option should you apply?

A.--network isolated
B.--network bridge
C.--network host
D.--network none
AnswerD

Correct. The none network mode disables all networking except loopback.

Why this answer

The 'none' network driver disables all external networking for the container, leaving only the loopback interface active.

40
MCQhard

You have created a Podman pod and want to launch two containers inside this pod so they share the same network namespace. How do you specify this during container creation?

A.podman run --pod mypod -d myimage
B.podman run --share-namespace mypod -d myimage
C.podman pod connect mypod myimage
D.podman run --network pod:mypod -d myimage
AnswerA

--pod shares the network namespace of the specified pod.

Why this answer

Using '--pod <pod_name>' places the new container inside an existing pod, sharing its network, IPC, and UTS namespaces.

41
Multi-Selecteasy

Which TWO actions can be performed using the 'podman network' subcommand? (Choose two.)

Select 2 answers
A.start
B.build
C.ls
D.commit
E.rm
AnswersC, E

Lists networks.

Why this answer

'podman network' manages networks including listing (ls) and removing (rm).

42
Multi-Selectmedium

Which THREE subcommands are valid under 'podman-compose' (or 'podman compose') for managing container lifecycles and application stacks? (Choose three.)

Select 3 answers
A.compile
B.logs
C.deploy
D.up
E.down
AnswersB, D, E

Displays container log outputs.

Why this answer

'up', 'down', and 'logs' are valid compose subcommands.

43
MCQhard

You need to troubleshoot name resolution between containers on a custom network. Which backend service does Podman utilize by default for container DNS resolution in modern rootless setups?

A.nscd
B.aardvark-dns
C.dnsmasq
D.bind9
AnswerB

Aardvark-dns provides container name resolution on Podman networks.

Why this answer

Aardvark-dns is the authoritative DNS server used alongside netavark for Podman networking.

44
MCQmedium

In a Podman Compose file, how do you define a custom network and connect a service to it?

A.Use the 'links:' directive inside the service block exclusively.
B.Add a 'network_mode' string directly pointing to an external shell script.
C.Define networks at the root level and reference them under each service configuration.
D.Configure networking exclusively via command-line environment variables.
AnswerC

This is the standard Docker/Podman Compose networking specification.

Why this answer

Compose files require a top-level 'networks:' section and service-level 'networks:' declarations.

45
Multi-Selectmedium

When publishing container ports using the Podman CLI, which THREE methods or syntaxes are valid for the -p / --publish flag? (Choose three)

Select 3 answers
A.-p 8080:80
B.-p 127.0.0.1:8080:80
C.-p container=80,host=8080
D.-p 80:8080:tcp:bind
E.-p 8080:80/udp
AnswersA, B, E

Correct. Standard host_port:container_port mapping.

Why this answer

Valid port publishing syntaxes include mapping host port to container port, specifying protocol (UDP/TCP), and binding to a specific host IP.

46
Multi-Selectmedium

Which THREE methods or directives can be used to pass environment variables into containers via Podman Compose? (Choose three.)

Select 3 answers
A.sysctl_env
B.env_file
C.container_env
D.Shell variable interpolation (e.g., ${VAR})
E.environment
AnswersB, D, E

Loads environment variables from external files.

Why this answer

Environment variables can be passed using 'environment', 'env_file', and shell interpolation.

47
MCQhard

You have a Kubernetes YAML manifest file named 'app.yaml' that defines a Pod with network settings. You want to deploy this directly as a Podman container/pod on your local system. Which command should you use?

A.podman-compose up --file app.yaml
B.podman run --kube app.yaml
C.podman apply -f app.yaml
D.podman play kube app.yaml
AnswerD

Correct. 'podman play kube' deploys workloads defined in a Kubernetes YAML file.

Why this answer

The 'podman play kube' command reads a Kubernetes YAML file and deploys the defined pods and containers locally.

48
Multi-Selectmedium

Which THREE configuration keys are valid within a service definition block in a Podman Compose file for managing container networking and ports? (Choose three.)

Select 3 answers
A.ports
B.interfaces
C.expose
D.firewall
E.networks
AnswersA, C, E

Valid key for port publishing.

Why this answer

'ports', 'expose', and 'networks' are valid compose keys.

49
MCQeasy

Which Podman network mode completely isolates a container from any network communication, removing all interfaces except the loopback?

A.--network none
B.--network isolated
C.--network closed
D.--network disabled
AnswerA

--network none isolates the container completely.

Why this answer

The 'none' network driver disables all external and internal networking for the container.

50
Multi-Selectmedium

Which TWO statements are true regarding user-defined bridge networks in Podman? (Choose two)

Select 2 answers
A.They require the host firewall to be completely disabled to function.
B.Containers attached to different user-defined networks can communicate without explicit routing.
C.They prevent containers from communicating with the outside internet entirely.
D.They allow administrators to specify custom subnets and gateways during creation.
E.They provide automatic internal DNS resolution so containers can reach each other by name.
AnswersD, E

Correct. The --subnet and --gateway flags can be specified when creating custom networks.

Why this answer

User-defined bridge networks provide automatic container name resolution via internal DNS and allow defining custom subnets.

51
MCQhard

When deploying containers using Podman Compose, what is the default network driver assigned to user-defined networks created by compose if no driver is specified?

A.host
B.macvlan
C.overlay
D.bridge
AnswerD

Bridge is the default network driver.

Why this answer

The default bridge driver is used for user-defined compose networks unless specified otherwise.

52
MCQmedium

You need to configure a container so that its port 8080 maps to port 80 on the host's loopback interface only (127.0.0.1). Which syntax is correct?

A.podman run --net 127.0.0.1:80:8080 myapp
B.podman run -p 80:8080/127.0.0.1 myapp
C.podman run --publish 8080:80/lo myapp
D.podman run -p 127.0.0.1:80:8080 myapp
AnswerD

Binds port 8080 in the container to port 80 on 127.0.0.1.

Why this answer

Specifying the IP address in the port mapping string restricts binding to that specific interface, preventing external network access to the forwarded port.

Ready to test yourself?

Try a timed practice session using only Networking And Compose questions.