diff options
-rw-r--r-- | cmd/podman/shared/create.go | 18 | ||||
-rw-r--r-- | docs/podman-export.1.md | 2 | ||||
-rw-r--r-- | libpod.conf | 6 | ||||
-rw-r--r-- | libpod/container_commit.go | 3 | ||||
-rw-r--r-- | libpod/runtime.go | 2 | ||||
-rw-r--r-- | test/e2e/checkpoint_test.go | 9 | ||||
-rw-r--r-- | test/e2e/common_test.go | 14 | ||||
-rw-r--r-- | test/e2e/create_staticip_test.go | 10 | ||||
-rw-r--r-- | test/e2e/run_staticip_test.go | 10 | ||||
-rw-r--r-- | test/system/005-info.bats | 2 |
10 files changed, 49 insertions, 27 deletions
diff --git a/cmd/podman/shared/create.go b/cmd/podman/shared/create.go index 9578eb17d..4de68e4bc 100644 --- a/cmd/podman/shared/create.go +++ b/cmd/podman/shared/create.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "github.com/containers/libpod/pkg/errorhandling" "io" "os" "path/filepath" @@ -18,6 +17,7 @@ import ( "github.com/containers/libpod/libpod" "github.com/containers/libpod/libpod/image" ann "github.com/containers/libpod/pkg/annotations" + "github.com/containers/libpod/pkg/errorhandling" "github.com/containers/libpod/pkg/inspect" ns "github.com/containers/libpod/pkg/namespaces" "github.com/containers/libpod/pkg/rootless" @@ -77,7 +77,13 @@ func CreateContainer(ctx context.Context, c *GenericCLIResults, runtime *libpod. writer = os.Stderr } - newImage, err := runtime.ImageRuntime().New(ctx, c.InputArgs[0], rtc.SignaturePolicyPath, GetAuthFile(""), writer, nil, image.SigningOptions{}, false, nil) + name := "" + if len(c.InputArgs) != 0 { + name = c.InputArgs[0] + } else { + return nil, nil, errors.Errorf("error, no input arguments were provided") + } + newImage, err := runtime.ImageRuntime().New(ctx, name, rtc.SignaturePolicyPath, GetAuthFile(""), writer, nil, image.SigningOptions{}, false, nil) if err != nil { return nil, nil, err } @@ -681,7 +687,7 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod. DNSServers: c.StringSlice("dns"), Entrypoint: entrypoint, Env: env, - //ExposedPorts: ports, + // ExposedPorts: ports, GroupAdd: c.StringSlice("group-add"), Hostname: c.String("hostname"), HostAdd: c.StringSlice("add-host"), @@ -693,16 +699,16 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod. Image: imageName, ImageID: imageID, Interactive: c.Bool("interactive"), - //IP6Address: c.String("ipv6"), // Not implemented yet - needs CNI support for static v6 + // IP6Address: c.String("ipv6"), // Not implemented yet - needs CNI support for static v6 IPAddress: c.String("ip"), Labels: labels, - //LinkLocalIP: c.StringSlice("link-local-ip"), // Not implemented yet + // LinkLocalIP: c.StringSlice("link-local-ip"), // Not implemented yet LogDriver: logDriver, LogDriverOpt: c.StringSlice("log-opt"), MacAddress: c.String("mac-address"), Name: c.String("name"), Network: network, - //NetworkAlias: c.StringSlice("network-alias"), // Not implemented - does this make sense in Podman? + // NetworkAlias: c.StringSlice("network-alias"), // Not implemented - does this make sense in Podman? IpcMode: ipcMode, NetMode: netMode, UtsMode: utsMode, diff --git a/docs/podman-export.1.md b/docs/podman-export.1.md index 27ebc724f..3ccd783d8 100644 --- a/docs/podman-export.1.md +++ b/docs/podman-export.1.md @@ -33,7 +33,7 @@ Print usage statement ``` $ podman export -o redis-container.tar 883504668ec465463bc0fe7e63d53154ac3b696ea8d7b233748918664ea90e57 -$ podman export > redis-container.tar 883504668ec465463bc0fe7e63d53154ac3b696ea8d7b233748918664ea90e57 +$ podman export 883504668ec465463bc0fe7e63d53154ac3b696ea8d7b233748918664ea90e57 > redis-container.tar ``` ## SEE ALSO diff --git a/libpod.conf b/libpod.conf index c92f60a10..6dd021c02 100644 --- a/libpod.conf +++ b/libpod.conf @@ -12,7 +12,8 @@ conmon_path = [ "/usr/bin/conmon", "/usr/sbin/conmon", "/usr/local/bin/conmon", - "/usr/local/sbin/conmon" + "/usr/local/sbin/conmon", + "/run/current-system/sw/bin/conmon", ] # Environment variables to pass into conmon @@ -128,7 +129,8 @@ runc = [ "/usr/local/sbin/runc", "/sbin/runc", "/bin/runc", - "/usr/lib/cri-o-runc/sbin/runc" + "/usr/lib/cri-o-runc/sbin/runc", + "/run/current-system/sw/bin/runc", ] crun = [ diff --git a/libpod/container_commit.go b/libpod/container_commit.go index 17586bfad..8dfeee9b8 100644 --- a/libpod/container_commit.go +++ b/libpod/container_commit.go @@ -19,7 +19,7 @@ import ( // ContainerCommitOptions is a struct used to commit a container to an image // It uses buildah's CommitOptions as a base. Long-term we might wish to // add these to the buildah struct once buildah is more integrated with -//libpod +// libpod type ContainerCommitOptions struct { buildah.CommitOptions Pause bool @@ -177,6 +177,7 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai return nil, errors.Errorf("invalid env variable %q: not defined in your environment", name) } } else { + name = change[0] val = strings.Join(change[1:], " ") } if !isEnvCleared { // Multiple values are valid, only clear once. diff --git a/libpod/runtime.go b/libpod/runtime.go index 28958e932..bb6bfbfcc 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -293,6 +293,7 @@ func defaultRuntimeConfig() (RuntimeConfig, error) { "/sbin/runc", "/bin/runc", "/usr/lib/cri-o-runc/sbin/runc", + "/run/current-system/sw/bin/runc", }, }, ConmonPath: []string{ @@ -302,6 +303,7 @@ func defaultRuntimeConfig() (RuntimeConfig, error) { "/usr/sbin/conmon", "/usr/local/bin/conmon", "/usr/local/sbin/conmon", + "/run/current-system/sw/bin/conmon", }, ConmonEnvVars: []string{ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go index b77c48c8e..8f3cf5c10 100644 --- a/test/e2e/checkpoint_test.go +++ b/test/e2e/checkpoint_test.go @@ -3,12 +3,9 @@ package integration import ( - "math/rand" "net" "os" "os/exec" - "strconv" - "time" "github.com/containers/libpod/pkg/criu" . "github.com/containers/libpod/test/utils" @@ -17,12 +14,8 @@ import ( ) func getRunString(input []string) []string { - // To avoid IP collisions of initialize random seed for random IP addresses - rand.Seed(time.Now().UnixNano()) - ip3 := strconv.Itoa(rand.Intn(230) + GinkgoParallelNode()) - ip4 := strconv.Itoa(rand.Intn(230) + GinkgoParallelNode()) // CRIU does not work with seccomp correctly on RHEL7 : seccomp=unconfined - runString := []string{"run", "-it", "--security-opt", "seccomp=unconfined", "-d", "--ip", "10.88." + ip3 + "." + ip4} + runString := []string{"run", "-it", "--security-opt", "seccomp=unconfined", "-d", "--ip", GetRandomIPAddress()} return append(runString, input...) } diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index 7e14f9e06..22eb94972 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -4,10 +4,12 @@ import ( "encoding/json" "fmt" "io/ioutil" + "math/rand" "os" "os/exec" "path/filepath" "sort" + "strconv" "strings" "testing" "time" @@ -339,6 +341,18 @@ func GetPortLock(port string) storage.Locker { return lock } +// GetRandomIPAddress returns a random IP address to avoid IP +// collisions during parallel tests +func GetRandomIPAddress() string { + // To avoid IP collisions of initialize random seed for random IP addresses + rand.Seed(time.Now().UnixNano()) + // Add GinkgoParallelNode() on top of the IP address + // in case of the same random seed + ip3 := strconv.Itoa(rand.Intn(230) + GinkgoParallelNode()) + ip4 := strconv.Itoa(rand.Intn(230) + GinkgoParallelNode()) + return "10.88." + ip3 + "." + ip4 +} + // RunTopContainer runs a simple container in the background that // runs top. If the name passed != "", it will have a name func (p *PodmanTestIntegration) RunTopContainer(name string) *PodmanSessionIntegration { diff --git a/test/e2e/create_staticip_test.go b/test/e2e/create_staticip_test.go index 11301856b..709e56665 100644 --- a/test/e2e/create_staticip_test.go +++ b/test/e2e/create_staticip_test.go @@ -60,7 +60,8 @@ var _ = Describe("Podman create with --ip flag", func() { }) It("Podman create with specified static IP has correct IP", func() { - result := podmanTest.Podman([]string{"create", "--name", "test", "--ip", "10.88.64.128", ALPINE, "ip", "addr"}) + ip := GetRandomIPAddress() + result := podmanTest.Podman([]string{"create", "--name", "test", "--ip", ip, ALPINE, "ip", "addr"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) @@ -71,14 +72,15 @@ var _ = Describe("Podman create with --ip flag", func() { result = podmanTest.Podman([]string{"logs", "test"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) - Expect(result.OutputToString()).To(ContainSubstring("10.88.64.128/16")) + Expect(result.OutputToString()).To(ContainSubstring(ip + "/16")) }) It("Podman create two containers with the same IP", func() { - result := podmanTest.Podman([]string{"create", "--name", "test1", "--ip", "10.88.64.128", ALPINE, "sleep", "999"}) + ip := GetRandomIPAddress() + result := podmanTest.Podman([]string{"create", "--name", "test1", "--ip", ip, ALPINE, "sleep", "999"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) - result = podmanTest.Podman([]string{"create", "--name", "test2", "--ip", "10.88.64.128", ALPINE, "ip", "addr"}) + result = podmanTest.Podman([]string{"create", "--name", "test2", "--ip", ip, ALPINE, "ip", "addr"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) result = podmanTest.Podman([]string{"start", "test1"}) diff --git a/test/e2e/run_staticip_test.go b/test/e2e/run_staticip_test.go index b9698cdd9..7a877ebdc 100644 --- a/test/e2e/run_staticip_test.go +++ b/test/e2e/run_staticip_test.go @@ -56,17 +56,19 @@ var _ = Describe("Podman run with --ip flag", func() { }) It("Podman run with specified static IP has correct IP", func() { - result := podmanTest.Podman([]string{"run", "-ti", "--ip", "10.88.63.2", ALPINE, "ip", "addr"}) + ip := GetRandomIPAddress() + result := podmanTest.Podman([]string{"run", "-ti", "--ip", ip, ALPINE, "ip", "addr"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) - Expect(result.OutputToString()).To(ContainSubstring("10.88.63.2/16")) + Expect(result.OutputToString()).To(ContainSubstring(ip + "/16")) }) It("Podman run two containers with the same IP", func() { - result := podmanTest.Podman([]string{"run", "-d", "--ip", "10.88.64.128", ALPINE, "sleep", "999"}) + ip := GetRandomIPAddress() + result := podmanTest.Podman([]string{"run", "-d", "--ip", ip, ALPINE, "sleep", "999"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) - result = podmanTest.Podman([]string{"run", "-ti", "--ip", "10.88.64.128", ALPINE, "ip", "addr"}) + result = podmanTest.Podman([]string{"run", "-ti", "--ip", ip, ALPINE, "ip", "addr"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).ToNot(Equal(0)) }) diff --git a/test/system/005-info.bats b/test/system/005-info.bats index 0068e35a9..7fccc75af 100644 --- a/test/system/005-info.bats +++ b/test/system/005-info.bats @@ -33,7 +33,7 @@ RunRoot: run_podman info --format=json expr_nvr="[a-z0-9-]\\\+-[a-z0-9.]\\\+-[a-z0-9]\\\+\." - expr_path="/[a-z0-9\\\/.]\\\+\\\$" + expr_path="/[a-z0-9\\\-\\\/.]\\\+\\\$" tests=" host.BuildahVersion | [0-9.] |