#501  DNS server added to docker is not recognized when build performed with OneDev Server Shell Executor
Closed
Stephen S opened 2 years ago

This is a bit complex, so please bear with me:

  1. I have a local DNS server at 192.168.1.52 which allows me to give domain names to all our self-hosted applications (in a subdomain of our main address)
  2. I execute OneDev from a docker container
  3. To be able to access my DNS server, I added these instructions to the docker-compose.yml file of OneDev:
    dns:
      - "192.168.1.52"
    network_mode: "bridge"

Result: it works fine and when accessing bash from within the OneDev docker container, I can cat /etc/resolv.conf and the result is correct:

search lan.***.com
nameserver 192.168.1.52

I also checked the translation from the domain name to the IP address with host and it works.

Now that the DNS server is accessible and working from my OneDev docker container, I feel justified to use the domain name address of my docker registry instead of its IP Address when pushing an image to the registry at reg.lan.***.com:5000.

Unfortunately, It does not work and docker throws an error that proves that the DNS server is no longer recognized when executing an instruction from the Server Shell Executor:

17:05:54Get "http://reg.lan.***.com:5000/v2/": dial tcp: lookup reg.lan.***.com on 8.8.8.8:53: no such host
17:05:54The push refers to repository [reg.lan.***.com:5000/vsr-bas]
17:05:54Get "http://reg.lan.***.com:5000/v2/": dial tcp: lookup reg.lan.***.com on 8.8.8.8:53: no such host
17:05:54Step "build" is failed: Command failed with exit code 1

Instead the Server Shell Executor is relying on docker's default DNS server, Google's.

Stephen S changed title 2 years ago
Previous Value Current Value
DNS server added to docker is not recognized when build performed with OneDev
DNS server added to docker is not recognized when build performed with OneDev Server Shell Executor
Stephen S commented 2 years ago

Also, I checked if the whole operation would work by directly executing the instructions using bash from inside the OneDev docker container: it works and the domain name translation is indeed successful.

Robin Shen commented 2 years ago

All OneDev's docker operation is relayed to host docker due to use of -v /var/run/docker.sock:/var/run/docker.sock. So you need to configure host docker to make sure the DNS works.

Robin Shen changed state to 'Closed' 2 years ago
Previous Value Current Value
Open
Closed
issue 1 of 1
Type
Bug
Priority
Normal
Assignee
Affected Versions
Not Found
Issue Votes (0)
Watchers (3)
Reference
onedev/server#501
Please wait...
Page is in error, reload to recover