diff --git a/daemon/container_operations.go b/daemon/container_operations.go index a1b18aa7ff..76cdaac96a 100644 --- a/daemon/container_operations.go +++ b/daemon/container_operations.go @@ -359,7 +359,8 @@ func (daemon *Daemon) findAndAttachNetwork(container *container.Container, idOrN networkName := n.Name() containerName := strings.TrimPrefix(container.Name, "/") 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) } } }