mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add insecure registries to docker info
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
This commit is contained in:
parent
d78f8f2796
commit
44a50abe7b
4 changed files with 38 additions and 0 deletions
|
@ -151,5 +151,19 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
|
||||||
if info.ClusterAdvertise != "" {
|
if info.ClusterAdvertise != "" {
|
||||||
fmt.Fprintf(cli.out, "Cluster Advertise: %s\n", info.ClusterAdvertise)
|
fmt.Fprintf(cli.out, "Cluster Advertise: %s\n", info.ClusterAdvertise)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if info.RegistryConfig != nil && (len(info.RegistryConfig.InsecureRegistryCIDRs) > 0 || len(info.RegistryConfig.IndexConfigs) > 0) {
|
||||||
|
fmt.Fprintln(cli.out, "Insecure registries:")
|
||||||
|
for _, registry := range info.RegistryConfig.IndexConfigs {
|
||||||
|
if registry.Secure == false {
|
||||||
|
fmt.Fprintf(cli.out, " %s\n", registry.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, registry := range info.RegistryConfig.InsecureRegistryCIDRs {
|
||||||
|
mask, _ := registry.Mask.Size()
|
||||||
|
fmt.Fprintf(cli.out, " %s/%d\n", registry.IP.String(), mask)
|
||||||
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,9 @@ For example:
|
||||||
Registry: [https://index.docker.io/v1/]
|
Registry: [https://index.docker.io/v1/]
|
||||||
Labels:
|
Labels:
|
||||||
storage=ssd
|
storage=ssd
|
||||||
|
Insecure registries:
|
||||||
|
myinsecurehost:5000
|
||||||
|
127.0.0.0/8
|
||||||
|
|
||||||
The global `-D` option tells all `docker` commands to output debug information.
|
The global `-D` option tells all `docker` commands to output debug information.
|
||||||
|
|
||||||
|
|
|
@ -164,3 +164,21 @@ func (s *DockerSuite) TestInfoDebug(c *check.C) {
|
||||||
c.Assert(out, checker.Contains, "EventsListeners")
|
c.Assert(out, checker.Contains, "EventsListeners")
|
||||||
c.Assert(out, checker.Contains, "Docker Root Dir")
|
c.Assert(out, checker.Contains, "Docker Root Dir")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *DockerSuite) TestInsecureRegistries(c *check.C) {
|
||||||
|
testRequires(c, SameHostDaemon, DaemonIsLinux)
|
||||||
|
|
||||||
|
registryCIDR := "192.168.1.0/24"
|
||||||
|
registryHost := "insecurehost.com:5000"
|
||||||
|
|
||||||
|
d := NewDaemon(c)
|
||||||
|
err := d.Start("--insecure-registry="+registryCIDR, "--insecure-registry="+registryHost)
|
||||||
|
c.Assert(err, checker.IsNil)
|
||||||
|
defer d.Stop()
|
||||||
|
|
||||||
|
out, err := d.Cmd("info")
|
||||||
|
c.Assert(err, checker.IsNil)
|
||||||
|
c.Assert(out, checker.Contains, "Insecure registries:\n")
|
||||||
|
c.Assert(out, checker.Contains, fmt.Sprintf(" %s\n", registryHost))
|
||||||
|
c.Assert(out, checker.Contains, fmt.Sprintf(" %s\n", registryCIDR))
|
||||||
|
}
|
||||||
|
|
|
@ -59,6 +59,9 @@ Here is a sample output:
|
||||||
Debug mode (server): false
|
Debug mode (server): false
|
||||||
Username: xyz
|
Username: xyz
|
||||||
Registry: https://index.docker.io/v1/
|
Registry: https://index.docker.io/v1/
|
||||||
|
Insecure registries:
|
||||||
|
myinsecurehost:5000
|
||||||
|
127.0.0.0/8
|
||||||
|
|
||||||
# HISTORY
|
# HISTORY
|
||||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue