Skip to content

Fix dns resolver for docker #435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: int
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dnsconfig.go
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ const (
// https://unix.stackexchange.com/questions/508397/what-is-the-recommended-way-to-set-a-global-dns-server-override-on-a-system-usin
// Domains=~. instructs systemd-resolved to always use the global nameservers
// and to never query any DHCP-supplied nameservers
localDnsServer = "[Resolve]\nDNS=127.0.0.1\nDomains=~.\n"
localDnsServer = "[Resolve]\nDNS=127.0.0.1 172.17.0.1\nDomains=~.\n"
)

func updateDockerConfig(configPath string) error {
@@ -46,7 +46,7 @@ func updateDockerConfig(configPath string) error {
return errors.Wrap(err, "failed to unmarshal config file")
}

m["dns"] = []string{dockerDnsServer}
// m["dns"] = []string{dockerDnsServer}
m["live-restore"] = true
// m["userns-remap"] = "runner:runner" // Checkout: https://docs.docker.com/engine/security/userns-remap/#enable-userns-remap-on-the-daemon

6 changes: 3 additions & 3 deletions dnsconfig_test.go
Original file line number Diff line number Diff line change
@@ -41,11 +41,11 @@ func Test_updateDockerConfig(t *testing.T) {
}{
{name: "existing file",
args: args{configPath: tmpFileName},
want: "{\"cgroup-parent\":\"/actions_job\",\"dns\":[\"172.17.0.1\"],\"live-restore\":true}",
want: "{\"cgroup-parent\":\"/actions_job\",\"live-restore\":true}",
wantErr: false},
{name: "non existent file",
args: args{configPath: mockDockerConfigPath},
want: "{\"dns\":[\"172.17.0.1\"],\"live-restore\":true}",
want: "{\"live-restore\":true}",
wantErr: false},
}

@@ -79,7 +79,7 @@ func Test_writeResolveConfig(t *testing.T) {
}{
{name: "overwrite file",
args: args{configPath: tmpFileName},
want: "[Resolve]\nDNS=127.0.0.1\nDomains=~.\n",
want: "[Resolve]\nDNS=127.0.0.1 172.17.0.1\nDomains=~.\n",
wantErr: false},
}
for _, tt := range tests {