Commit 0777a6f9 authored by Florian Klink's avatar Florian Klink Committed by Kamil Trzciński

docker executor: use DNS, DNSSearch and ExtraHosts settings from configuration

parent a4743fa3
......@@ -690,7 +690,10 @@ func (e *executor) createService(serviceIndex int, service, version, image strin
config.Entrypoint = e.overwriteEntrypoint(&serviceDefinition)
hostConfig := &container.HostConfig{
DNS: e.Config.Docker.DNS,
DNSSearch: e.Config.Docker.DNSSearch,
RestartPolicy: neverRestartPolicy,
ExtraHosts: e.Config.Docker.ExtraHosts,
Privileged: e.Config.Docker.Privileged,
NetworkMode: container.NetworkMode(e.Config.Docker.NetworkMode),
Binds: e.binds,
......
......@@ -1081,6 +1081,43 @@ func TestDockerTmpfsSetting(t *testing.T) {
testDockerConfigurationWithJobContainer(t, dockerConfig, cce)
}
func TestDockerServicesDNSSetting(t *testing.T) {
dockerConfig := &common.DockerConfig{
DNS: []string{"2001:db8::1", "192.0.2.1"},
}
cce := func(t *testing.T, config *container.Config, hostConfig *container.HostConfig) {
require.Equal(t, dockerConfig.DNS, hostConfig.DNS)
}
testDockerConfigurationWithServiceContainer(t, dockerConfig, cce)
}
func TestDockerServicesDNSSearchSetting(t *testing.T) {
dockerConfig := &common.DockerConfig{
DNSSearch: []string{"mydomain.example"},
}
cce := func(t *testing.T, config *container.Config, hostConfig *container.HostConfig) {
require.Equal(t, dockerConfig.DNSSearch, hostConfig.DNSSearch)
}
testDockerConfigurationWithServiceContainer(t, dockerConfig, cce)
}
func TestDockerServicesExtraHostsSetting(t *testing.T) {
dockerConfig := &common.DockerConfig{
ExtraHosts: []string{"foo.example:2001:db8::1", "bar.example:192.0.2.1"},
}
cce := func(t *testing.T, config *container.Config, hostConfig *container.HostConfig) {
require.Equal(t, dockerConfig.ExtraHosts, hostConfig.ExtraHosts)
}
testDockerConfigurationWithServiceContainer(t, dockerConfig, cce)
}
func TestDockerUserNSSetting(t *testing.T) {
dockerConfig := &common.DockerConfig{
UsernsMode: "host",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment