Skip to content

Commit

Permalink
chore: push Privileged back to layer 1
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelapenya committed Nov 22, 2022
1 parent dd9bd20 commit 0a09cf6
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion container.go
Expand Up @@ -108,7 +108,7 @@ type ContainerRequest struct {
Name string // for specifying container name
Hostname string
ExtraHosts []string // Deprecated: Use PreCreateModifier instead
Privileged bool // Deprecated: Use PreCreateModifier instead. For starting privileged container
Privileged bool // Use PreCreateModifier instead. For starting privileged container
Networks []string // for specifying network names
NetworkAliases map[string][]string // for specifying network aliases
NetworkMode container.NetworkMode // Deprecated: Use PreCreateModifier instead
Expand Down
3 changes: 2 additions & 1 deletion docker.go
Expand Up @@ -1045,7 +1045,8 @@ func (p *DockerProvider) CreateContainer(ctx context.Context, req ContainerReque
}

hostConfig := &container.HostConfig{
Tmpfs: req.Tmpfs,
Privileged: req.Privileged,
Tmpfs: req.Tmpfs,
}

networkingConfig := &network.NetworkingConfig{}
Expand Down
6 changes: 2 additions & 4 deletions docker_test.go
Expand Up @@ -152,10 +152,10 @@ func TestContainerWithHostNetworkOptions(t *testing.T) {
ExposedPorts: []string{
nginxHighPort,
},
Privileged: true,
WaitingFor: wait.ForListeningPort(nginxHighPort),
PreCreateModifier: func(hc *container.HostConfig, es map[string]*network.EndpointSettings) {
hc.NetworkMode = "host"
hc.Privileged = true
},
},
Started: true,
Expand Down Expand Up @@ -186,11 +186,9 @@ func TestContainerWithHostNetworkOptions_UseExposePortsFromImageConfigs(t *testi
gcr := GenericContainerRequest{
ContainerRequest: ContainerRequest{
Image: "nginx",
Privileged: true,
SkipReaper: true,
WaitingFor: wait.ForExposedPort(),
PreCreateModifier: func(hc *container.HostConfig, es map[string]*network.EndpointSettings) {
hc.Privileged = true
},
},
Started: true,
}
Expand Down
1 change: 0 additions & 1 deletion lifecycle.go
Expand Up @@ -71,7 +71,6 @@ func defaultPreCreateModifier(req ContainerRequest) func(hostConfig *container.H
hostConfig.Binds = req.Binds
hostConfig.ExtraHosts = req.ExtraHosts
hostConfig.NetworkMode = req.NetworkMode
hostConfig.Privileged = req.Privileged
hostConfig.Resources = req.Resources
hostConfig.ShmSize = req.ShmSize
}
Expand Down
2 changes: 1 addition & 1 deletion reaper.go
Expand Up @@ -70,11 +70,11 @@ func NewReaper(ctx context.Context, sessionID string, provider ReaperProvider, r
},
SkipReaper: true,
Mounts: Mounts(BindMount(dockerHost, "/var/run/docker.sock")),
Privileged: tcConfig.RyukPrivileged,
WaitingFor: wait.ForListeningPort(listeningPort),
PreCreateModifier: func(hc *container.HostConfig, es map[string]*network.EndpointSettings) {
hc.AutoRemove = true
hc.NetworkMode = Bridge
hc.Privileged = tcConfig.RyukPrivileged
},
}

Expand Down

0 comments on commit 0a09cf6

Please sign in to comment.