Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 1aabe29

Browse files
authored
Merge pull request #404 from joshwget/dns-opt
Add dns_opt
2 parents c0bb633 + f9dff7d commit 1aabe29

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

config/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type ServiceConfigV1 struct {
3030
ContainerName string `yaml:"container_name,omitempty"`
3131
Devices []string `yaml:"devices,omitempty"`
3232
DNS yaml.Stringorslice `yaml:"dns,omitempty"`
33+
DNSOpts []string `yaml:"dns_opt,omitempty"`
3334
DNSSearch yaml.Stringorslice `yaml:"dns_search,omitempty"`
3435
Dockerfile string `yaml:"dockerfile,omitempty"`
3536
DomainName string `yaml:"domainname,omitempty"`
@@ -94,6 +95,7 @@ type ServiceConfig struct {
9495
Devices []string `yaml:"devices,omitempty"`
9596
DependsOn []string `yaml:"depends_on,omitempty"`
9697
DNS yaml.Stringorslice `yaml:"dns,omitempty"`
98+
DNSOpts []string `yaml:"dns_opt,omitempty"`
9799
DNSSearch yaml.Stringorslice `yaml:"dns_search,omitempty"`
98100
DomainName string `yaml:"domainname,omitempty"`
99101
Entrypoint yaml.Command `yaml:"entrypoint,flow,omitempty"`

docker/service/convert.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ func Convert(c *config.ServiceConfig, ctx project.Context, clientFactory compose
251251
Privileged: c.Privileged,
252252
Binds: Filter(vols, isBind),
253253
DNS: utils.CopySlice(c.DNS),
254+
DNSOptions: utils.CopySlice(c.DNSOpts),
254255
DNSSearch: utils.CopySlice(c.DNSSearch),
255256
LogConfig: container.LogConfig{
256257
Type: c.Logging.Driver,

docker/service/convert_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,23 @@ func TestParseLabels(t *testing.T) {
8181
assert.Equal(t, []string{"less"}, []string(cfg.Entrypoint))
8282
}
8383

84+
func TestDNSOpt(t *testing.T) {
85+
ctx := &ctx.Context{}
86+
sc := &config.ServiceConfig{
87+
DNSOpts: []string{
88+
"use-vc",
89+
"no-tld-query",
90+
},
91+
}
92+
_, hostCfg, err := Convert(sc, ctx.Context, nil)
93+
assert.Nil(t, err)
94+
95+
assert.True(t, reflect.DeepEqual([]string{
96+
"use-vc",
97+
"no-tld-query",
98+
}, hostCfg.DNSOptions))
99+
}
100+
84101
func TestGroupAdd(t *testing.T) {
85102
ctx := &ctx.Context{}
86103
sc := &config.ServiceConfig{

0 commit comments

Comments
 (0)