Skip to content
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

docker: configure restart policy for networking pause container #15732

Merged
merged 1 commit into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .changelog/15732.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
docker: configure restart policy for bridge network pause container
```
6 changes: 6 additions & 0 deletions drivers/docker/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ func (d *Driver) createSandboxContainerConfig(allocID string, createSpec *driver
// Set the network mode to none which creates a network namespace
// with only a loopback interface.
NetworkMode: "none",

// Set the restart policy to unless-stopped. The pause container should
// never not be running until Nomad issues a stop.
//
// https://docs.docker.com/engine/reference/run/#restart-policies---restart
RestartPolicy: docker.RestartUnlessStopped(),
},
}, nil
}
Expand Down
6 changes: 4 additions & 2 deletions drivers/docker/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ func TestDriver_createSandboxContainerConfig(t *testing.T) {
Image: "gcr.io/google_containers/pause-amd64:3.1",
},
HostConfig: &docker.HostConfig{
NetworkMode: "none",
NetworkMode: "none",
RestartPolicy: docker.RestartUnlessStopped(),
},
},
name: "no input hostname",
Expand All @@ -45,7 +46,8 @@ func TestDriver_createSandboxContainerConfig(t *testing.T) {
Hostname: "linux",
},
HostConfig: &docker.HostConfig{
NetworkMode: "none",
NetworkMode: "none",
RestartPolicy: docker.RestartUnlessStopped(),
},
},
name: "supplied input hostname",
Expand Down