-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Closed
Labels
kind/featureFunctionality or other elements that the project doesn't currently have. Features are new and shinyFunctionality or other elements that the project doesn't currently have. Features are new and shinystatus/0-triage
Description
Description
Description
ErrConflictHostNetwork was added in #17476.
Line 9 in c90cbc8
| ErrConflictHostNetwork validationError = "container cannot be disconnected from host network or connected to host network" |
Confusingly, the same error message is used for two different errors.
- When attempting to change the network mode of a running container from a different mode to
host.
moby/daemon/container_operations.go
Lines 175 to 177 in c90cbc8
if !ctr.HostConfig.NetworkMode.IsHost() && containertypes.NetworkMode(n.Type()).IsHost() { return runconfig.ErrConflictHostNetwork } - When the network mode of a running container is already
hostand attempting to disconnect fromhost.
moby/daemon/container_operations.go
Lines 1055 to 1057 in c90cbc8
if ctr.HostConfig.NetworkMode.IsHost() && containertypes.NetworkMode(n.Type()).IsHost() { return runconfig.ErrConflictHostNetwork }
Using the same error message for these two errors makes troubleshooting difficult.
Suggestions
Split the ErrConflictHostNetwork error into two distinct errors:
ErrConflictConnectToHostNetworkwhen attempting to change the network mode of a running container from a different mode tohostErrConflictDisconnectFromHostNetworkwhen the network mode of a running container ishostand attempting to disconnect fromhost
Related
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind/featureFunctionality or other elements that the project doesn't currently have. Features are new and shinyFunctionality or other elements that the project doesn't currently have. Features are new and shinystatus/0-triage