compose icon indicating copy to clipboard operation
compose copied to clipboard

How to apply a dns server running in docker-compsoe to another service running in the same docker-compsoe?

Open aa51513 opened this issue 3 years ago • 1 comments

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?

aa51513 avatar Jan 25 '22 07:01 aa51513

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.

stale[bot] avatar Jul 31 '22 02:07 stale[bot]

This issue has been automatically closed because it had not recent activity during the stale period.

stale[bot] avatar Nov 02 '22 03:11 stale[bot]