77 "errors"
88 "fmt"
99 "io"
10- "net/netip"
1110 "os"
1211 "path"
1312 "strings"
@@ -25,7 +24,6 @@ import (
2524 "github.com/docker/cli/cli/trust"
2625 "github.com/docker/cli/internal/jsonstream"
2726 "github.com/docker/cli/opts"
28- "github.com/moby/moby/api/types/container"
2927 "github.com/moby/moby/api/types/mount"
3028 "github.com/moby/moby/api/types/versions"
3129 "github.com/moby/moby/client"
@@ -361,10 +359,6 @@ func createContainer(ctx context.Context, dockerCli command.Cli, containerCfg *c
361359 }
362360 }
363361
364- if warn := localhostDNSWarning (* hostConfig ); warn != "" {
365- response .Warnings = append (response .Warnings , warn )
366- }
367-
368362 containerID = response .ID
369363 for _ , w := range response .Warnings {
370364 _ , _ = fmt .Fprintln (dockerCli .Err (), "WARNING:" , w )
@@ -385,19 +379,6 @@ func createContainer(ctx context.Context, dockerCli command.Cli, containerCfg *c
385379 return containerID , err
386380}
387381
388- // check the DNS settings passed via --dns against localhost regexp to warn if
389- // they are trying to set a DNS to a localhost address.
390- //
391- // TODO(thaJeztah): move this to the daemon, which can make a better call if it will work or not (depending on networking mode).
392- func localhostDNSWarning (hostConfig container.HostConfig ) string {
393- for _ , dnsIP := range hostConfig .DNS {
394- if addr , err := netip .ParseAddr (dnsIP ); err == nil && addr .IsLoopback () {
395- return fmt .Sprintf ("Localhost DNS (%s) may fail in containers." , addr )
396- }
397- }
398- return ""
399- }
400-
401382func validatePullOpt (val string ) error {
402383 switch val {
403384 case PullImageAlways , PullImageMissing , PullImageNever , "" :
0 commit comments