How to apply a dns server running in docker-compsoe to another service running in the same docker-compsoe?
For business needs, I used docker-compose to orchestrate a dns server, and the service name in docker-compose is my_dns_server.
I would like to use the above dns server for domain name resolution in the container where my business is running.
My config file is as follows:
version: '3.8'
services:
my_dns_server:
image: coredns/coredns
container_name: coredns
restart: always
volumes:
- /etc/coredns/Corefile:/etc/coredns/Corefile:ro
my_business_service:
image: my/business:latest
container_name: my_business_service
restart: always
volumes:
- /etc/my/config.yml:/etc/my/config.yml:ro
depends_on:
- my_dns_server
dns: my_dns_server
In fact, the above configuration does not work at all. In my business container, I cannot perform any external network DNS resolution. I want to know, is there something wrong with my configuration, or docker-compose itself does not support this configuration, and how should I achieve the above requirements?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed because it had not recent activity during the stale period.