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:
Sebastiaan van Stijn
2024-06-16 22:30:22 +02:00
parent 4af9f418a3
commit afdfe4ff86
3 changed files with 9 additions and 3 deletions

View File

@@ -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
}