ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
14.04k stars 3.42k forks source link

Add docker DNS resolver configuration option #14959

Open jacobmaussocc opened 8 months ago

jacobmaussocc commented 8 months ago

Please confirm the following

Feature type

New Feature

Feature Summary

USING DOCKER INSTALL

I was running into issues with my DNS not resolving inside of the UI or in the container exec.

When first setting up my environment I was unable to resolve the name of my hashicorp vault server when created the credentials for it, and I had to use the ip address of the server, this made it so the wildcard cert I use does not work. this was the error when using the hostname

<urllib3.connection.HTTPSConnection object at 0x7ff9d15bee50>: Failed to establish a new connection: [Errno -2] Name or service not known

I fear I over thought a lot of stuff, but my current solution was to make a changed to the jinja template for rendering the docker compose to manually add

dns:
  - nameserver1
  - nameserver2

This worked just as expected, I was just wondering if there would be a better way to implement this feature, or it very well could be that I am honestly not all that well versed on docker, but I do not want all of my containers to have this functionality so I did not like the idea of changing the daemon. I would like if this was maybe included in the inventory file.

Select the relevant components

Steps to reproduce

Basic install to get error, edit jinja as noted for fix.

Current results

Currently, with no configuration I cannot resolve using the hosts /etc/resolv.conf

Sugested feature result

Add options for DNS configuration?

Additional information

I am young, and not familiar with a lot of this software I apologize if this is an elementary question, just trying to either learn or help.

dmzoneill commented 7 months ago

@jacobmaussocc

Thank you for your feedback.

Can you provide the details of your host? Some distros provide intermediate dns cachers, which give rise to problematic behaviours. (systemd-resolved/...). You might see that your /etc/resolve conf points to 127.0.0.1 which is an intermediate caching and resolver.

The reason I ask this is that per the docker documentation, docker is configured to use host DNS. https://docs.docker.com/network/

There are any number of configuration scenarios and intermediate DNS cachers that could provide an undesired experience like the one you are describing.

In some cases system administrators turn off these local daemons and just maintain /etc/resolve with the appropriate upstream DNS servers.

I'm not suggesting you do this, but if you can provide a better understanding of your configuration, we might be able to provide better guidance with your particular setup.

docker-compose absolutely does provide for the type of request you are suggesting, that may very well be a good enhancement for AWX/tower/AAP.

If look forward to understanding this issue further.

thedoubl3j commented 7 months ago

@jacobmaussocc @dmzoneill the docker-compose env is for development purposes only. If you are hitting this issue because you are trying to develop a feature for AWX, we are definitely happy to help debug that but the docker-compose environment is not built to persist. If this instance needs to persist, I would suggest installing via the operator.