diff options
Diffstat (limited to 'cmd/podman/common')
-rw-r--r-- | cmd/podman/common/completion.go | 16 | ||||
-rw-r--r-- | cmd/podman/common/create.go | 4 | ||||
-rw-r--r-- | cmd/podman/common/create_opts.go | 18 | ||||
-rw-r--r-- | cmd/podman/common/createparse.go | 2 | ||||
-rw-r--r-- | cmd/podman/common/default.go | 2 | ||||
-rw-r--r-- | cmd/podman/common/diffChanges.go | 2 | ||||
-rw-r--r-- | cmd/podman/common/netflags.go | 8 | ||||
-rw-r--r-- | cmd/podman/common/specgen.go | 27 | ||||
-rw-r--r-- | cmd/podman/common/util.go | 2 | ||||
-rw-r--r-- | cmd/podman/common/volumes.go | 4 |
10 files changed, 44 insertions, 41 deletions
diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go index ff15983cd..7629a8145 100644 --- a/cmd/podman/common/completion.go +++ b/cmd/podman/common/completion.go @@ -7,14 +7,14 @@ import ( "strings" "github.com/containers/common/pkg/config" - "github.com/containers/podman/v2/cmd/podman/registry" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/registries" - "github.com/containers/podman/v2/pkg/rootless" - systemdGen "github.com/containers/podman/v2/pkg/systemd/generate" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/cmd/podman/registry" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/registries" + "github.com/containers/podman/v3/pkg/rootless" + systemdGen "github.com/containers/podman/v3/pkg/systemd/generate" + "github.com/containers/podman/v3/pkg/util" "github.com/spf13/cobra" ) diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go index fe43967a2..d1170710b 100644 --- a/cmd/podman/common/create.go +++ b/cmd/podman/common/create.go @@ -5,8 +5,8 @@ import ( "github.com/containers/common/pkg/auth" "github.com/containers/common/pkg/completion" - "github.com/containers/podman/v2/cmd/podman/registry" - "github.com/containers/podman/v2/libpod/define" + "github.com/containers/podman/v3/cmd/podman/registry" + "github.com/containers/podman/v3/libpod/define" "github.com/spf13/cobra" ) diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go index 430354ee9..78611371d 100644 --- a/cmd/podman/common/create_opts.go +++ b/cmd/podman/common/create_opts.go @@ -7,12 +7,12 @@ import ( "strconv" "strings" - "github.com/containers/podman/v2/cmd/podman/registry" - "github.com/containers/podman/v2/pkg/api/handlers" - "github.com/containers/podman/v2/pkg/cgroups" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/rootless" - "github.com/containers/podman/v2/pkg/specgen" + "github.com/containers/podman/v3/cmd/podman/registry" + "github.com/containers/podman/v3/pkg/api/handlers" + "github.com/containers/podman/v3/pkg/cgroups" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/rootless" + "github.com/containers/podman/v3/pkg/specgen" ) type ContainerCLIOpts struct { @@ -223,7 +223,11 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup // publish for port, pbs := range cc.HostConfig.PortBindings { for _, pb := range pbs { - hostport, err := strconv.Atoi(pb.HostPort) + var hostport int + var err error + if pb.HostPort != "" { + hostport, err = strconv.Atoi(pb.HostPort) + } if err != nil { return nil, nil, err } diff --git a/cmd/podman/common/createparse.go b/cmd/podman/common/createparse.go index 140518cf7..818cd0bbd 100644 --- a/cmd/podman/common/createparse.go +++ b/cmd/podman/common/createparse.go @@ -1,7 +1,7 @@ package common import ( - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/pkg/util" "github.com/pkg/errors" ) diff --git a/cmd/podman/common/default.go b/cmd/podman/common/default.go index af64e7162..7e025c449 100644 --- a/cmd/podman/common/default.go +++ b/cmd/podman/common/default.go @@ -1,7 +1,7 @@ package common import ( - "github.com/containers/podman/v2/cmd/podman/registry" + "github.com/containers/podman/v3/cmd/podman/registry" ) var ( diff --git a/cmd/podman/common/diffChanges.go b/cmd/podman/common/diffChanges.go index 4aa485acc..7930e4f2c 100644 --- a/cmd/podman/common/diffChanges.go +++ b/cmd/podman/common/diffChanges.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/containers/podman/v2/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/domain/entities" "github.com/containers/storage/pkg/archive" "github.com/pkg/errors" ) diff --git a/cmd/podman/common/netflags.go b/cmd/podman/common/netflags.go index 9cb4ed550..bc4d54de0 100644 --- a/cmd/podman/common/netflags.go +++ b/cmd/podman/common/netflags.go @@ -5,10 +5,10 @@ import ( "strings" "github.com/containers/common/pkg/completion" - "github.com/containers/podman/v2/cmd/podman/parse" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/containers/podman/v2/pkg/specgen" + "github.com/containers/podman/v3/cmd/podman/parse" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/specgen" "github.com/pkg/errors" "github.com/spf13/cobra" ) diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go index 975c76fd9..2fafbfac1 100644 --- a/cmd/podman/common/specgen.go +++ b/cmd/podman/common/specgen.go @@ -8,14 +8,14 @@ import ( "time" "github.com/containers/image/v5/manifest" - "github.com/containers/podman/v2/cmd/podman/parse" - "github.com/containers/podman/v2/libpod/define" - ann "github.com/containers/podman/v2/pkg/annotations" - envLib "github.com/containers/podman/v2/pkg/env" - ns "github.com/containers/podman/v2/pkg/namespaces" - "github.com/containers/podman/v2/pkg/specgen" - systemdGen "github.com/containers/podman/v2/pkg/systemd/generate" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/cmd/podman/parse" + "github.com/containers/podman/v3/libpod/define" + ann "github.com/containers/podman/v3/pkg/annotations" + envLib "github.com/containers/podman/v3/pkg/env" + ns "github.com/containers/podman/v3/pkg/namespaces" + "github.com/containers/podman/v3/pkg/specgen" + systemdGen "github.com/containers/podman/v3/pkg/systemd/generate" + "github.com/containers/podman/v3/pkg/util" "github.com/docker/go-units" "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" @@ -148,17 +148,16 @@ func getMemoryLimits(s *specgen.SpecGenerator, c *ContainerCLIOpts) (*specs.Linu } if m := c.MemorySwap; len(m) > 0 { var ms int64 - if m == "-1" { - ms = int64(-1) - s.ResourceLimits.Memory.Swap = &ms - } else { + // only set memory swap if it was set + // -1 indicates unlimited + if m != "-1" { ms, err = units.RAMInBytes(m) + memory.Swap = &ms if err != nil { return nil, errors.Wrapf(err, "invalid value for memory") } + hasLimits = true } - memory.Swap = &ms - hasLimits = true } if m := c.KernelMemory; len(m) > 0 { mk, err := units.RAMInBytes(m) diff --git a/cmd/podman/common/util.go b/cmd/podman/common/util.go index ef30e08d3..2a8b2040c 100644 --- a/cmd/podman/common/util.go +++ b/cmd/podman/common/util.go @@ -6,7 +6,7 @@ import ( "strconv" "strings" - "github.com/containers/podman/v2/pkg/specgen" + "github.com/containers/podman/v3/pkg/specgen" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/cmd/podman/common/volumes.go b/cmd/podman/common/volumes.go index 2a598d7a5..19a49a6f2 100644 --- a/cmd/podman/common/volumes.go +++ b/cmd/podman/common/volumes.go @@ -6,8 +6,8 @@ import ( "strings" "github.com/containers/common/pkg/parse" - "github.com/containers/podman/v2/pkg/specgen" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/pkg/specgen" + "github.com/containers/podman/v3/pkg/util" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" ) |