mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Change Forbidden Error (403) to Conflict(409)
Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
This commit is contained in:
parent
871acb1c86
commit
31e8fcc678
1 changed files with 2 additions and 1 deletions
|
@ -359,7 +359,8 @@ func (daemon *Daemon) findAndAttachNetwork(container *container.Container, idOrN
|
||||||
networkName := n.Name()
|
networkName := n.Name()
|
||||||
containerName := strings.TrimPrefix(container.Name, "/")
|
containerName := strings.TrimPrefix(container.Name, "/")
|
||||||
if network, ok := container.NetworkSettings.Networks[networkName]; ok && network.EndpointID != "" {
|
if network, ok := container.NetworkSettings.Networks[networkName]; ok && network.EndpointID != "" {
|
||||||
return n, nil, types.ForbiddenErrorf("%s is already attached to network %s", containerName, networkName)
|
err := fmt.Errorf("%s is already attached to network %s", containerName, networkName)
|
||||||
|
return n, nil, errdefs.Conflict(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue