mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
runconfig: deprecate SetDefaultNetModeIfBlank
Remove uses of this function and mark it deprecated. There's no known consumers of this function, but let's stay on the safe side, and mark it deprected for 1 release. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"github.com/containerd/log"
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
networktypes "github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/api/types/strslice"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/daemon/config"
|
||||
@@ -19,7 +20,6 @@ import (
|
||||
"github.com/docker/docker/oci/caps"
|
||||
"github.com/docker/docker/opts"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
"github.com/docker/docker/runconfig"
|
||||
volumemounts "github.com/docker/docker/volume/mounts"
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/moby/sys/signal"
|
||||
@@ -218,7 +218,9 @@ func (daemon *Daemon) setHostConfig(container *container.Container, hostConfig *
|
||||
return err
|
||||
}
|
||||
|
||||
runconfig.SetDefaultNetModeIfBlank(hostConfig)
|
||||
if hostConfig != nil && hostConfig.NetworkMode == "" {
|
||||
hostConfig.NetworkMode = networktypes.NetworkDefault
|
||||
}
|
||||
container.HostConfig = hostConfig
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -231,7 +231,9 @@ func (daemon *Daemon) create(ctx context.Context, daemonCfg *config.Config, opts
|
||||
}
|
||||
// Make sure NetworkMode has an acceptable value. We do this to ensure
|
||||
// backwards API compatibility.
|
||||
runconfig.SetDefaultNetModeIfBlank(ctr.HostConfig)
|
||||
if ctr.HostConfig != nil && ctr.HostConfig.NetworkMode == "" {
|
||||
ctr.HostConfig.NetworkMode = networktypes.NetworkDefault
|
||||
}
|
||||
|
||||
daemon.updateContainerNetworkSettings(ctr, endpointsConfigs)
|
||||
if err := daemon.Register(ctr); err != nil {
|
||||
|
||||
@@ -11,6 +11,8 @@ import (
|
||||
// to default if it is not populated. This ensures backwards compatibility after
|
||||
// the validation of the network mode was moved from the docker CLI to the
|
||||
// docker daemon.
|
||||
//
|
||||
// Deprecated: SetDefaultNetModeIfBlank is no longer used abnd will be removed in the next release.
|
||||
func SetDefaultNetModeIfBlank(hc *container.HostConfig) {
|
||||
if hc != nil && hc.NetworkMode == "" {
|
||||
hc.NetworkMode = network.NetworkDefault
|
||||
|
||||
Reference in New Issue
Block a user