Skip to content

Commit

Permalink
Merge fe9bd3f into backport/b-pause-container-restart-policy/personal…
Browse files Browse the repository at this point in the history
…ly-decent-hen
  • Loading branch information
hc-github-team-nomad-core committed Jan 10, 2023
2 parents d3cdea4 + fe9bd3f commit 73a600e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
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

0 comments on commit 73a600e

Please sign in to comment.