summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/create.go14
-rw-r--r--cmd/podman/spec.go13
2 files changed, 27 insertions, 0 deletions
diff --git a/cmd/podman/create.go b/cmd/podman/create.go
index 262be129c..55425638f 100644
--- a/cmd/podman/create.go
+++ b/cmd/podman/create.go
@@ -83,6 +83,7 @@ type createConfig struct {
Env map[string]string //env
ExposedPorts map[nat.Port]struct{}
GroupAdd []uint32 // group-add
+ HostAdd []string //add-host
Hostname string //hostname
Image string
ImageID string
@@ -560,6 +561,18 @@ func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime, imageName string,
networkMode = c.String("net")
}
+ // Verify the additional hosts are in correct format
+ for _, host := range c.StringSlice("add-host") {
+ if _, err := validateExtraHost(host); err != nil {
+ return nil, err
+ }
+ }
+
+ // Check for . and dns-search domains
+ if libpod.StringInSlice(".", c.StringSlice("dns-search")) && len(c.StringSlice("dns-search")) > 1 {
+ return nil, errors.Errorf("cannot pass additional search domains when also specifying '.'")
+ }
+
config := &createConfig{
Runtime: runtime,
CapAdd: c.StringSlice("cap-add"),
@@ -576,6 +589,7 @@ func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime, imageName string,
ExposedPorts: ports,
GroupAdd: groupAdd,
Hostname: c.String("hostname"),
+ HostAdd: c.StringSlice("add-host"),
Image: imageName,
ImageID: imageID,
Interactive: c.Bool("interactive"),
diff --git a/cmd/podman/spec.go b/cmd/podman/spec.go
index 59ea5685a..152d1740c 100644
--- a/cmd/podman/spec.go
+++ b/cmd/podman/spec.go
@@ -584,6 +584,19 @@ func (c *createConfig) GetContainerCreateOptions() ([]libpod.CtrCreateOption, er
options = append(options, libpod.WithStopSignal(c.StopSignal))
options = append(options, libpod.WithStopTimeout(c.StopTimeout))
+ if len(c.DNSSearch) > 0 {
+ options = append(options, libpod.WithDNSSearch(c.DNSSearch))
+ }
+ if len(c.DNSServers) > 0 {
+ options = append(options, libpod.WithDNS(c.DNSServers))
+ }
+ if len(c.DNSOpt) > 0 {
+ options = append(options, libpod.WithDNSOption(c.DNSOpt))
+ }
+ if len(c.HostAdd) > 0 {
+ options = append(options, libpod.WithHosts(c.HostAdd))
+ }
+
return options, nil
}