AZ-204 Develop Azure compute solutions Practice Question
You are running a containerized application on Azure Container Instances. The application requires a custom DNS server. How should you configure this?
⚠ Common exam trap
Candidates often assume DNS configuration can be set via environment variables or the Dockerfile, similar to how they might configure it in a standalone Docker environment, but ACI requires explicit container group-level network settings that override any container-level DNS directives.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use the 'dnsConfig' property in the container group configuration
Azure Container Instances (ACI) supports custom DNS server configuration at the container group level via the 'dnsConfig' property in the deployment JSON or ARM template. This property allows you to specify an array of DNS server IP addresses and optional search domains, which are applied to all containers within the group. Environment variables cannot override DNS resolution, and the Dockerfile's DNS settings are ignored by ACI because the container group's network stack is managed by the Azure platform.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Set the DNS server in the container's environment variables
Why it's wrong here
Environment variables are primarily used to pass application-specific configuration values into a running container, such as database connection strings or feature flags. They do not provide a mechanism to configure fundamental operating system or network-level settings, like the DNS servers used for name resolution by the container's network stack. Therefore, attempting to set DNS servers via environment variables would not globally redirect all DNS queries originating from the container.
- ✓
Use the 'dnsConfig' property in the container group configuration
Why this is correct
The 'dnsConfig' property is a specific configuration setting within Azure Container Instances (ACI) that allows administrators to define custom DNS servers and search domains for an entire container group. When this property is used, ACI injects these specified DNS settings directly into the `/etc/resolv.conf` file of each container within that group. This ensures that all DNS queries originating from any container in the group will use the custom servers, effectively overriding the default Azure-provided DNS resolution.
- ✗
Set the restart policy to 'Always'
Why it's wrong here
A container's restart policy, such as 'Always', 'OnFailure', or 'Never', dictates how Azure Container Instances (ACI) manages the container's lifecycle in response to termination events. This policy solely governs whether and when a container is automatically restarted after it stops, crashes, or completes its task. It has no functional impact whatsoever on the container's network configuration, including its DNS resolution settings, which are established at the time of container creation.
- ✗
Configure the DNS server in the Dockerfile
Why it's wrong here
A Dockerfile defines the steps to build a Docker image, specifying the base image, dependencies, environment setup, and application commands. While it can install DNS-related tools or configure application-specific DNS settings within the image, it cannot configure the runtime DNS resolution for the container host or the Azure Container Instances (ACI) network. Runtime DNS settings are applied by the container orchestrator (ACI) when the container is deployed, not during the image build process.
Visual reference
Go deeper
Related to this question
About these practice questions
One of 881 original AZ-204 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-204 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-204 exam.