|
@@ -15,6 +15,7 @@ import (
|
|
|
"github.com/Sirupsen/logrus"
|
|
|
"github.com/docker/docker/autogen/dockerversion"
|
|
|
"github.com/docker/docker/daemon/graphdriver"
|
|
|
+ "github.com/docker/docker/nat"
|
|
|
"github.com/docker/docker/pkg/archive"
|
|
|
"github.com/docker/docker/pkg/fileutils"
|
|
|
"github.com/docker/docker/pkg/parsers"
|
|
@@ -129,6 +130,12 @@ func (daemon *Daemon) verifyContainerSettings(hostConfig *runconfig.HostConfig,
|
|
|
return warnings, nil
|
|
|
}
|
|
|
|
|
|
+ for port := range hostConfig.PortBindings {
|
|
|
+ _, portStr := nat.SplitProtoPort(string(port))
|
|
|
+ if _, err := nat.ParsePort(portStr); err != nil {
|
|
|
+ return warnings, fmt.Errorf("Invalid port specification: %s", portStr)
|
|
|
+ }
|
|
|
+ }
|
|
|
if hostConfig.LxcConf.Len() > 0 && !strings.Contains(daemon.ExecutionDriver().Name(), "lxc") {
|
|
|
return warnings, fmt.Errorf("Cannot use --lxc-conf with execdriver: %s", daemon.ExecutionDriver().Name())
|
|
|
}
|