libnetwork: Controller.NewSandbox: don't generate ID if not used
Windows uses the container-iD as ID for sandboxes, so it's not needed to generate an ID when running on Windows. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
389b21a341
commit
2eccf0e8d1
1 changed files with 5 additions and 5 deletions
|
@ -887,13 +887,13 @@ func (c *Controller) NewSandbox(containerID string, options ...SandboxOption) (_
|
|||
}
|
||||
c.mu.Unlock()
|
||||
|
||||
sandboxID := stringid.GenerateRandomID()
|
||||
if runtime.GOOS == "windows" {
|
||||
sandboxID = containerID
|
||||
}
|
||||
|
||||
// Create sandbox and process options first. Key generation depends on an option
|
||||
if sb == nil {
|
||||
// TODO(thaJeztah): given that a "containerID" must be unique in the list of sandboxes, is there any reason we're not using containerID as sandbox ID on non-Windows?
|
||||
sandboxID := containerID
|
||||
if runtime.GOOS != "windows" {
|
||||
sandboxID = stringid.GenerateRandomID()
|
||||
}
|
||||
sb = &Sandbox{
|
||||
id: sandboxID,
|
||||
containerID: containerID,
|
||||
|
|
Loading…
Add table
Reference in a new issue