Network Connectivity Check
Which Docker command can you use to inspect the network configuration of a running container and check for IP address and gateway?
- docker stats u003Ccontainer_idu003E
- docker logs u003Ccontainer_idu003E
- docker inspect u003Ccontainer_idu003E
- docker ps u003Ccontainer_idu003E
- docker exec u003Ccontainer_idu003E ifconfig
DNS Resolution Issues
A Docker container fails to resolve hostnames. What is the most likely cause of this issue?
- The container is not running in detached mode.
- The container does not have sufficient CPU resources.
- The container's DNS settings are incorrectly configured or it cannot reach the DNS server.
- The Docker daemon is not running.
- The Docker image is corrupted.
Port Mapping and Accessibility
You've mapped port 80 of your host machine to port 8080 of a Docker container, but you cannot access the application from your browser using 'localhost:80'. What's a possible cause?
- The container's firewall is blocking port 8080.
- The application inside the container is not listening on port 8080.
- The Docker daemon is not running with root privileges.
- The host machine does not have a web browser installed.
- The port mapping was not correctly created during 'docker run'
User-Defined Networks
What is the primary benefit of using user-defined networks in Docker, compared to the default bridge network?
- Automatic load balancing across containers.
- Automatic container restart policies.
- DNS resolution by container name, allowing containers to find each other using their names.
- Improved CPU utilization for containers.
- Increased network security through encryption
Connecting to External Databases
A Docker container needs to connect to a database running on the host machine. How can you achieve this (assuming the database port is open on the host)?
- Use 'localhost' as the database host in the container.
- Use 'host.docker.internal' as the database host in the container.
- Use the container's IP address as the database host.
- Use the default bridge network for communication.
- No special configuration is needed; it will connect automatically.
Inter-Container Communication
Two containers, 'web' and 'db', are on the same user-defined network. The 'web' container needs to access the 'db' container. How should the 'web' container address the 'db' container?
- Using the 'db' container's IP address directly.
- Using 'localhost' as the hostname.
- Using the container ID of 'db'.
- Using 'db' as the hostname.
- Using 'web' as the hostname.
Container Firewall
You can connect to your Docker container from other containers, but you cannot connect from your Host machine. What is the most likely cause?
- The container is not correctly configured.
- The Docker network is blocking external access.
- The port is not exposed correctly when running the container
- The container's hostname is not resolvable.
- The host operating system is not supported by Docker.
Debugging DNS Resolution Errors
You are receiving errors related to DNS resolution within a Docker container. Which tool is most helpful for diagnosing the DNS server the container is using?
- docker stats
- nslookup or dig inside the container
- docker system prune
- docker build --no-cache
- docker compose up --force-recreate
Overlay Network Considerations
When using Docker Swarm, what type of network is typically used for communication between services deployed across multiple nodes?
- Bridge Network
- Host Network
- Overlay Network
- MACVLAN Network
- None network
Inspect Bridge Network
Which command is most appropriate to check the IP address range, subnet and other configuration settings of the default Docker bridge network?
- docker network create
- docker inspect bridge
- docker ps -a
- docker run --network=none
- docker stop