How do you disconnect a running container from a custom network named 'mynet'?
Disconnects the container from the network.
Why this answer
'podman network disconnect' removes a container from a specified network.
52 questions · Networking And Compose · All types, answers revealed
How do you disconnect a running container from a custom network named 'mynet'?
Disconnects the container from the network.
Why this answer
'podman network disconnect' removes a container from a specified network.
You need to inspect the configuration details, including subnet, gateway, and driver, of a custom Podman network named 'appnet'. Which command should you run?
This command shows detailed JSON configuration for the network.
Why this answer
'podman network inspect' displays detailed low-level network configurations in JSON format.
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?
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.
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?
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.
When inspecting the networking of a container using 'podman inspect', where is the IP address of the container located in the output JSON structure?
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.
Which environment file option can be used in a Podman Compose file to automatically load environment variables for service configuration?
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.
Which flag allows you to publish a container port to a random ephemeral port on the host interface?
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.
You wish to connect an already running container to an existing custom Podman network named 'mynet'. Which command should you use?
Connects the specified container to the network.
Why this answer
'podman network connect' attaches a running or stopped container to a specified network.
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)
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.
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?
Specifies service startup dependencies.
Why this answer
The 'depends_on' directive controls startup order of services in compose files.
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?
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.
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?
--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.
Which command starts services defined in a Podman Compose file in detached mode?
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.
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?
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.
Which configuration block in a Podman Compose YAML file is used to define custom isolated networks for the multi-container application?
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.
Which THREE actions occur when a container is executed with the --network none flag? (Choose three)
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.
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?
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.
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?
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.
When utilizing Podman Compose, how are service dependencies and container startup orders typically managed within the YAML structure?
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.
How do you stop and remove containers, networks, and volumes created by a Podman Compose file?
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.
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?
Correct. This command outputs detailed network metadata.
Why this answer
The 'podman network inspect' command displays detailed configuration JSON for a specified network.
How do you check the logs of all services managed by a Podman Compose file?
Shows logs for compose services.
Why this answer
'podman-compose logs' displays log output from all services defined in the compose file.
When generating a Kubernetes Pod YAML from a Podman container using 'podman generate kubernetes', how are published ports mapped into the resulting Kubernetes manifest?
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.
You want to create a Podman network with a specific subnet and gateway. Which command correctly specifies these parameters?
--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.
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?
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'.
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?
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.
You want to remove a custom Podman network named 'testnet', but it currently has active containers attached to it. What happens?
Active containers prevent network removal.
Why this answer
Podman prevents network deletion while active endpoints/containers are connected to ensure integrity.
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.)
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.
Which THREE commands are valid Podman subcommands for managing container networks? (Choose three)
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'.
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?
Sets custom DNS servers for the container.
Why this answer
The --dns flag specifies custom DNS servers for the container.
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?
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.
How do you list all available Podman networks on your system?
Lists all networks.
Why this answer
'podman network ls' lists all configured container networks.
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?
Standard format for mapping host port to container port.
Why this answer
The 'ports' directive uses strings or lists in 'HOST:CONTAINER' format.
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?
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.
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?
Correct. 'podman network rm' removes the specified network.
Why this answer
The 'podman network rm' command deletes an existing unused user-defined network.
Which command removes all unused Podman networks that are not currently connected to any containers?
Removes unused networks.
Why this answer
'podman network prune' deletes unused networks.
When configuring container networking in Podman, which TWO built-in network modes are available by default without creating custom networks? (Choose two)
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).
When generating Kubernetes YAML using 'podman generate kubernetes', which TWO object types can be targeted or generated by the command? (Choose two.)
Can generate a Kubernetes Deployment manifest.
Why this answer
Podman can generate Kubernetes Pod and Deployment manifests.
You are troubleshooting a container that should have no network access whatsoever for security isolation. Which networking option should you apply?
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.
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?
--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.
Which TWO actions can be performed using the 'podman network' subcommand? (Choose two.)
Lists networks.
Why this answer
'podman network' manages networks including listing (ls) and removing (rm).
Which THREE subcommands are valid under 'podman-compose' (or 'podman compose') for managing container lifecycles and application stacks? (Choose three.)
Displays container log outputs.
Why this answer
'up', 'down', and 'logs' are valid compose subcommands.
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?
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.
In a Podman Compose file, how do you define a custom network and connect a service to it?
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.
When publishing container ports using the Podman CLI, which THREE methods or syntaxes are valid for the -p / --publish flag? (Choose three)
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.
Which THREE methods or directives can be used to pass environment variables into containers via Podman Compose? (Choose three.)
Loads environment variables from external files.
Why this answer
Environment variables can be passed using 'environment', 'env_file', and shell interpolation.
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?
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.
Which THREE configuration keys are valid within a service definition block in a Podman Compose file for managing container networking and ports? (Choose three.)
Valid key for port publishing.
Why this answer
'ports', 'expose', and 'networks' are valid compose keys.
Which Podman network mode completely isolates a container from any network communication, removing all interfaces except the loopback?
--network none isolates the container completely.
Why this answer
The 'none' network driver disables all external and internal networking for the container.
Which TWO statements are true regarding user-defined bridge networks in Podman? (Choose two)
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.
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?
Bridge is the default network driver.
Why this answer
The default bridge driver is used for user-defined compose networks unless specified otherwise.
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?
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.