Configuring the Docker container DNS
If Docker runs on a virtual machine (Docker for Mac, Docker for Windows), the default container DNS configuration differs from the one of the physical machine. In that case you need to configure the DNS in the Docker configuration file provided with the Remote Engine Gen2.
Procedure
Results
version: '3.6'
networks: ...
volumes:...
services:
...
component-server:
image: ${COMPONENTS_IMG}
...
labels:...
dns:
- 8.8.8.8
- 9.9.9.9
dns_search:
- dc1.example.com
- dc2.example.com
extra_hosts:
- "somehost:162.242.195.82"
- "otherhost:50.31.209.229"
...
For more information on this topic, see the Docker documentation.
Learn more:
A number of options specified at run time can affect the DNS service resolution for the Docker container, but in absence of such options the default behavior is that Docker uses the /etc/resolv.conf of the host machine. The host machine is where the Docker daemon runs. In some cases Docker may not run on the physical machine but rather on a virtual machine and this is why you might need to configure the Docker container DNS manually in the docker-compose.yml file.