summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--go.mod4
-rw-r--r--go.sum9
-rw-r--r--libpod/container_internal_linux.go11
-rw-r--r--pkg/bindings/test/containers_test.go11
-rw-r--r--pkg/domain/infra/abi/play.go21
-rw-r--r--pkg/spec/createconfig.go10
-rw-r--r--test/e2e/play_kube_test.go184
-rw-r--r--test/e2e/run_passwd_test.go13
-rw-r--r--vendor/github.com/google/uuid/README.md2
-rw-r--r--vendor/github.com/google/uuid/marshal.go7
-rw-r--r--vendor/github.com/google/uuid/version1.go12
-rw-r--r--vendor/github.com/google/uuid/version4.go7
-rw-r--r--vendor/modules.txt4
13 files changed, 262 insertions, 33 deletions
diff --git a/go.mod b/go.mod
index 11258d70f..5fe7d8d53 100644
--- a/go.mod
+++ b/go.mod
@@ -12,7 +12,7 @@ require (
github.com/containernetworking/plugins v0.8.7
github.com/containers/buildah v1.15.1-0.20200813183340-0a8dc1f8064c
github.com/containers/common v0.20.3-0.20200827091701-a550d6a98aa3
- github.com/containers/conmon v2.0.19+incompatible
+ github.com/containers/conmon v2.0.20+incompatible
github.com/containers/image/v5 v5.5.2
github.com/containers/psgo v1.5.1
github.com/containers/storage v1.23.2
@@ -28,7 +28,7 @@ require (
github.com/ghodss/yaml v1.0.0
github.com/godbus/dbus/v5 v5.0.3
github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf
- github.com/google/uuid v1.1.1
+ github.com/google/uuid v1.1.2
github.com/gorilla/mux v1.7.4
github.com/gorilla/schema v1.2.0
github.com/hashicorp/go-multierror v1.1.0
diff --git a/go.sum b/go.sum
index 951a03e51..d55bce0fc 100644
--- a/go.sum
+++ b/go.sum
@@ -74,8 +74,8 @@ github.com/containers/buildah v1.15.1-0.20200813183340-0a8dc1f8064c/go.mod h1:+I
github.com/containers/common v0.19.0/go.mod h1:+NUHV8V5Kmo260ja9Dxtr8ialrDnK4RNzyeEbSgmLac=
github.com/containers/common v0.20.3-0.20200827091701-a550d6a98aa3 h1:rTSiIMOH3fbCBN+2L8Xr9BJ19AejEIaBQvzkAXZCz/k=
github.com/containers/common v0.20.3-0.20200827091701-a550d6a98aa3/go.mod h1:z5HJtHWU8sopAHO0Od5s9EpVkXPrLIcNszVvN1Fc3fQ=
-github.com/containers/conmon v2.0.19+incompatible h1:1bDVRvHy2MUNTUT/SW6LlHsJHQBTSwXvnKNdcB/a1vQ=
-github.com/containers/conmon v2.0.19+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I=
+github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg=
+github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I=
github.com/containers/image/v5 v5.5.1/go.mod h1:4PyNYR0nwlGq/ybVJD9hWlhmIsNra4Q8uOQX2s6E2uM=
github.com/containers/image/v5 v5.5.2 h1:fv7FArz0zUnjH0W0l8t90CqWFlFcQrPP6Pug+9dUtVI=
github.com/containers/image/v5 v5.5.2/go.mod h1:4PyNYR0nwlGq/ybVJD9hWlhmIsNra4Q8uOQX2s6E2uM=
@@ -87,7 +87,6 @@ github.com/containers/ocicrypt v1.0.3/go.mod h1:CUBa+8MRNL/VkpxYIpaMtgn1WgXGyvPQ
github.com/containers/psgo v1.5.1 h1:MQNb7FLbXqBdqz6u4lI2QWizVz4RSTzs1+Nk9XT1iVA=
github.com/containers/psgo v1.5.1/go.mod h1:2ubh0SsreMZjSXW1Hif58JrEcFudQyIy9EzPUWfawVU=
github.com/containers/storage v1.20.2/go.mod h1:oOB9Ie8OVPojvoaKWEGSEtHbXUAs+tSyr7RO7ZGteMc=
-github.com/containers/storage v1.23.0 h1:gYyNkBiihC2FvGiHOjOjpnfojYwgxpLVooTUlmD6pxs=
github.com/containers/storage v1.23.0/go.mod h1:I1EIAA7B4OwWRSA0b4yq2AW1wjvvfcY0zLWQuwTa4zw=
github.com/containers/storage v1.23.2 h1:GPZ8PXYezML1gmZ/uFaXQpyps7AH645lmdvvOJwJYNc=
github.com/containers/storage v1.23.2/go.mod h1:AyTMMiE5ANvZJiqvatQgSZ85wAl5yHucY3NDN/kemr4=
@@ -214,6 +213,8 @@ github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf/go.mod h1:RpwtwJQFrIE
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
+github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
github.com/gophercloud/gophercloud v0.0.0-20190126172459-c818fa66e4c8/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4=
@@ -261,7 +262,6 @@ github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQL
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.10.8/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
-github.com/klauspost/compress v1.10.10 h1:a/y8CglcM7gLGYmlbP/stPE5sR3hbhFRUjCBfd/0B3I=
github.com/klauspost/compress v1.10.10/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.10.11 h1:K9z59aO18Aywg2b/WSgBaUX99mHy2BES18Cr5lBKZHk=
github.com/klauspost/compress v1.10.11/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
@@ -405,7 +405,6 @@ github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8 h1:2c1EFnZHIPCW8q
github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4=
github.com/seccomp/containers-golang v0.6.0 h1:VWPMMIDr8pAtNjCX0WvLEEK9EQi5lAm4HtJbDtAtFvQ=
github.com/seccomp/containers-golang v0.6.0/go.mod h1:Dd9mONHvW4YdbSzdm23yf2CFw0iqvqLhO0mEFvPIvm4=
-github.com/seccomp/libseccomp-golang v0.9.1 h1:NJjM5DNFOs0s3kYE1WUOr6G8V97sdt46rlXTMfXGWBo=
github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo=
github.com/seccomp/libseccomp-golang v0.9.2-0.20200616122406-847368b35ebf h1:b0+ZBD3rohnkQ4q5duD1+RyTXTg9yk+qTOPMSQtapO0=
github.com/seccomp/libseccomp-golang v0.9.2-0.20200616122406-847368b35ebf/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg=
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 31dbee572..c61c1a325 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -1584,6 +1584,17 @@ func (c *Container) generatePasswd() (string, error) {
if _, err := os.Stat(passwdPath); err == nil {
return passwdPath, nil
}
+ // Check if container has a /etc/passwd - if it doesn't do nothing.
+ passwdPath, err := securejoin.SecureJoin(c.state.Mountpoint, "/etc/passwd")
+ if err != nil {
+ return "", errors.Wrapf(err, "error creating path to container %s /etc/passwd", c.ID())
+ }
+ if _, err := os.Stat(passwdPath); err != nil {
+ if os.IsNotExist(err) {
+ return "", nil
+ }
+ return "", errors.Wrapf(err, "unable to access container %s /etc/passwd", c.ID())
+ }
pwd := ""
if c.config.User != "" {
entry, err := c.generateUserPasswdEntry()
diff --git a/pkg/bindings/test/containers_test.go b/pkg/bindings/test/containers_test.go
index db5be4909..bf2ceab2a 100644
--- a/pkg/bindings/test/containers_test.go
+++ b/pkg/bindings/test/containers_test.go
@@ -2,7 +2,6 @@ package test_bindings
import (
"net/http"
- "strconv"
"strings"
"time"
@@ -10,7 +9,6 @@ import (
"github.com/containers/podman/v2/pkg/bindings"
"github.com/containers/podman/v2/pkg/bindings/containers"
"github.com/containers/podman/v2/pkg/specgen"
- "github.com/containers/podman/v2/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
@@ -182,14 +180,6 @@ var _ = Describe("Podman containers ", func() {
})
It("podman remove a paused container by id with force", func() {
- // FIXME: Skip on F31 and later
- host := utils.GetHostDistributionInfo()
- osVer, err := strconv.Atoi(host.Version)
- Expect(err).To(BeNil())
- if host.Distribution == "fedora" && osVer >= 31 {
- Skip("FIXME: https://github.com/containers/podman/issues/5325")
- }
-
// Removing a paused container with force should work
var name = "top"
cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
@@ -280,7 +270,6 @@ var _ = Describe("Podman containers ", func() {
})
It("podman wait to pause|unpause condition", func() {
- Skip("FIXME: https://github.com/containers/podman/issues/6518")
var (
name = "top"
exitCode int32 = -1
diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go
index 4ebc37cda..31ad51672 100644
--- a/pkg/domain/infra/abi/play.go
+++ b/pkg/domain/infra/abi/play.go
@@ -144,6 +144,16 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
podOptions = append(podOptions, libpod.WithPodHostNetwork())
}
+ if podYAML.Spec.HostAliases != nil {
+ hosts := make([]string, 0, len(podYAML.Spec.HostAliases))
+ for _, hostAlias := range podYAML.Spec.HostAliases {
+ for _, host := range hostAlias.Hostnames {
+ hosts = append(hosts, host+":"+hostAlias.IP)
+ }
+ }
+ podOptions = append(podOptions, libpod.WithPodHosts(hosts))
+ }
+
nsOptions, err := generate.GetNamespaceOptions(strings.Split(createconfig.DefaultKernelNamespaces, ","))
if err != nil {
return nil, err
@@ -250,13 +260,22 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
if err := libpod.LabelVolumePath(hostPath.Path); err != nil {
return nil, errors.Wrapf(err, "Error giving %s a label", hostPath.Path)
}
+ case v1.HostPathSocket:
+ st, err := os.Stat(hostPath.Path)
+ if err != nil {
+ return nil, errors.Wrapf(err, "Error checking HostPathSocket")
+ }
+ if st.Mode()&os.ModeSocket != os.ModeSocket {
+ return nil, errors.Errorf("Error checking HostPathSocket: path %s is not a socket", hostPath.Path)
+ }
+
case v1.HostPathDirectory:
case v1.HostPathFile:
case v1.HostPathUnset:
// do nothing here because we will verify the path exists in validateVolumeHostDir
break
default:
- return nil, errors.Errorf("Directories are the only supported HostPath type")
+ return nil, errors.Errorf("Invalid HostPath type %v", hostPath.Type)
}
}
diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go
index e0c875fe9..4887e9262 100644
--- a/pkg/spec/createconfig.go
+++ b/pkg/spec/createconfig.go
@@ -267,6 +267,16 @@ func (c *CreateConfig) getContainerCreateOptions(runtime *libpod.Runtime, pod *l
options = append(options, runtime.WithPod(pod))
}
+ // handle some spec from the InfraContainer when it's a pod
+ if pod != nil && pod.HasInfraContainer() {
+ InfraCtr, err := pod.InfraContainer()
+ if err != nil {
+ return nil, err
+ }
+ // handle the pod.spec.hostAliases
+ options = append(options, libpod.WithHosts(InfraCtr.HostsAdd()))
+ }
+
if len(mounts) != 0 || len(namedVolumes) != 0 {
destinations := []string{}
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 053e27126..121cea017 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -42,6 +42,14 @@ metadata:
spec:
hostname: {{ .Hostname }}
+ hostAliases:
+{{ range .HostAliases }}
+ - hostnames:
+ {{ range .HostName }}
+ - {{ . }}
+ {{ end }}
+ ip: {{ .IP }}
+{{ end }}
containers:
{{ with .Ctrs }}
{{ range . }}
@@ -94,6 +102,15 @@ spec:
{{ end }}
{{ end }}
{{ end }}
+{{ with .Volumes }}
+ volumes:
+ {{ range . }}
+ - name: {{ .Name }}
+ hostPath:
+ path: {{ .Path }}
+ type: {{ .Type }}
+ {{ end }}
+{{ end }}
status: {}
`
@@ -186,6 +203,7 @@ var (
defaultCtrArg = []string{"-d", "1.5"}
defaultCtrImage = ALPINE
defaultPodName = "testPod"
+ defaultVolName = "testVol"
defaultDeploymentName = "testDeployment"
seccompPwdEPERM = []byte(`{"defaultAction":"SCMP_ACT_ALLOW","syscalls":[{"name":"getcwd","action":"SCMP_ACT_ERRNO"}]}`)
)
@@ -239,15 +257,22 @@ func generateDeploymentKubeYaml(deployment *Deployment, fileName string) error {
type Pod struct {
Name string
Hostname string
+ HostAliases []HostAlias
Ctrs []*Ctr
+ Volumes []*Volume
Annotations map[string]string
}
+type HostAlias struct {
+ IP string
+ HostName []string
+}
+
// getPod takes a list of podOptions and returns a pod with sane defaults
// and the configured options
// if no containers are added, it will add the default container
func getPod(options ...podOption) *Pod {
- p := Pod{defaultPodName, "", make([]*Ctr, 0), make(map[string]string)}
+ p := Pod{defaultPodName, "", nil, make([]*Ctr, 0), make([]*Volume, 0), make(map[string]string)}
for _, option := range options {
option(&p)
}
@@ -265,6 +290,15 @@ func withHostname(h string) podOption {
}
}
+func withHostAliases(ip string, host []string) podOption {
+ return func(pod *Pod) {
+ pod.HostAliases = append(pod.HostAliases, HostAlias{
+ IP: ip,
+ HostName: host,
+ })
+ }
+}
+
func withCtr(c *Ctr) podOption {
return func(pod *Pod) {
pod.Ctrs = append(pod.Ctrs, c)
@@ -277,6 +311,12 @@ func withAnnotation(k, v string) podOption {
}
}
+func withVolume(v *Volume) podOption {
+ return func(pod *Pod) {
+ pod.Volumes = append(pod.Volumes, v)
+ }
+}
+
// Deployment describes the options a kube yaml can be configured at deployment level
type Deployment struct {
Name string
@@ -412,6 +452,22 @@ func getCtrNameInPod(pod *Pod) string {
return fmt.Sprintf("%s-%s", pod.Name, defaultCtrName)
}
+type Volume struct {
+ Name string
+ Path string
+ Type string
+}
+
+// getVolume takes a type and a location for a volume
+// giving it a default name of volName
+func getVolume(vType, vPath string) *Volume {
+ return &Volume{
+ Name: defaultVolName,
+ Path: vPath,
+ Type: vType,
+ }
+}
+
var _ = Describe("Podman generate kube", func() {
var (
tempdir string
@@ -564,6 +620,30 @@ var _ = Describe("Podman generate kube", func() {
Expect(inspect.OutputToString()).To(Equal(hostname))
})
+ It("podman play kube test HostAliases", func() {
+ pod := getPod(withHostAliases("192.168.1.2", []string{
+ "test1.podman.io",
+ "test2.podman.io",
+ }),
+ withHostAliases("192.168.1.3", []string{
+ "test3.podman.io",
+ "test4.podman.io",
+ }),
+ )
+ err := generatePodKubeYaml(pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "{{ .HostConfig.ExtraHosts }}"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect.OutputToString()).
+ To(Equal("[test1.podman.io:192.168.1.2 test2.podman.io:192.168.1.2 test3.podman.io:192.168.1.3 test4.podman.io:192.168.1.3]"))
+ })
+
It("podman play kube cap add", func() {
capAdd := "CAP_SYS_ADMIN"
ctr := getCtr(withCapAdd([]string{capAdd}), withCmd([]string{"cat", "/proc/self/status"}), withArg(nil))
@@ -853,4 +933,106 @@ spec:
Expect(inspect.ExitCode()).To(Equal(0))
Expect(inspect.OutputToString()).To(Equal("5000/tcp -> 127.0.0.100:5000"))
})
+
+ It("podman play kube test with non-existent empty HostPath type volume", func() {
+ hostPathLocation := filepath.Join(tempdir, "file")
+
+ pod := getPod(withVolume(getVolume(`""`, hostPathLocation)))
+ err := generatePodKubeYaml(pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).NotTo(Equal(0))
+ })
+
+ It("podman play kube test with empty HostPath type volume", func() {
+ hostPathLocation := filepath.Join(tempdir, "file")
+ f, err := os.Create(hostPathLocation)
+ Expect(err).To(BeNil())
+ f.Close()
+
+ pod := getPod(withVolume(getVolume(`""`, hostPathLocation)))
+ err = generatePodKubeYaml(pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+ })
+
+ It("podman play kube test with non-existent File HostPath type volume", func() {
+ hostPathLocation := filepath.Join(tempdir, "file")
+
+ pod := getPod(withVolume(getVolume("File", hostPathLocation)))
+ err := generatePodKubeYaml(pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).NotTo(Equal(0))
+ })
+
+ It("podman play kube test with File HostPath type volume", func() {
+ hostPathLocation := filepath.Join(tempdir, "file")
+ f, err := os.Create(hostPathLocation)
+ Expect(err).To(BeNil())
+ f.Close()
+
+ pod := getPod(withVolume(getVolume("File", hostPathLocation)))
+ err = generatePodKubeYaml(pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+ })
+
+ It("podman play kube test with FileOrCreate HostPath type volume", func() {
+ hostPathLocation := filepath.Join(tempdir, "file")
+
+ pod := getPod(withVolume(getVolume("FileOrCreate", hostPathLocation)))
+ err := generatePodKubeYaml(pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ // the file should have been created
+ _, err = os.Stat(hostPathLocation)
+ Expect(err).To(BeNil())
+ })
+
+ It("podman play kube test with DirectoryOrCreate HostPath type volume", func() {
+ hostPathLocation := filepath.Join(tempdir, "file")
+
+ pod := getPod(withVolume(getVolume("DirectoryOrCreate", hostPathLocation)))
+ err := generatePodKubeYaml(pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ // the file should have been created
+ st, err := os.Stat(hostPathLocation)
+ Expect(err).To(BeNil())
+ Expect(st.Mode().IsDir()).To(Equal(true))
+ })
+
+ It("podman play kube test with Socket HostPath type volume should fail if not socket", func() {
+ hostPathLocation := filepath.Join(tempdir, "file")
+ f, err := os.Create(hostPathLocation)
+ Expect(err).To(BeNil())
+ f.Close()
+
+ pod := getPod(withVolume(getVolume("Socket", hostPathLocation)))
+ err = generatePodKubeYaml(pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).NotTo(Equal(0))
+ })
})
diff --git a/test/e2e/run_passwd_test.go b/test/e2e/run_passwd_test.go
index 8dea7d39b..c48876dee 100644
--- a/test/e2e/run_passwd_test.go
+++ b/test/e2e/run_passwd_test.go
@@ -58,4 +58,17 @@ var _ = Describe("Podman run passwd", func() {
Expect(session.ExitCode()).To(Equal(0))
Expect(session.LineInOutputContains("passwd")).To(BeTrue())
})
+
+ It("podman can run container without /etc/passwd", func() {
+ SkipIfRemote()
+ dockerfile := `FROM alpine
+RUN rm -f /etc/passwd /etc/shadow /etc/group
+USER 1000`
+ imgName := "testimg"
+ podmanTest.BuildImage(dockerfile, imgName, "false")
+ session := podmanTest.Podman([]string{"run", "--rm", imgName, "ls", "/etc/"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(Not(ContainSubstring("passwd")))
+ })
})
diff --git a/vendor/github.com/google/uuid/README.md b/vendor/github.com/google/uuid/README.md
index 9d92c11f1..f765a46f9 100644
--- a/vendor/github.com/google/uuid/README.md
+++ b/vendor/github.com/google/uuid/README.md
@@ -16,4 +16,4 @@ change is the ability to represent an invalid UUID (vs a NIL UUID).
Full `go doc` style documentation for the package can be viewed online without
installing this package by using the GoDoc site here:
-http://godoc.org/github.com/google/uuid
+http://pkg.go.dev/github.com/google/uuid
diff --git a/vendor/github.com/google/uuid/marshal.go b/vendor/github.com/google/uuid/marshal.go
index 7f9e0c6c0..14bd34072 100644
--- a/vendor/github.com/google/uuid/marshal.go
+++ b/vendor/github.com/google/uuid/marshal.go
@@ -16,10 +16,11 @@ func (uuid UUID) MarshalText() ([]byte, error) {
// UnmarshalText implements encoding.TextUnmarshaler.
func (uuid *UUID) UnmarshalText(data []byte) error {
id, err := ParseBytes(data)
- if err == nil {
- *uuid = id
+ if err != nil {
+ return err
}
- return err
+ *uuid = id
+ return nil
}
// MarshalBinary implements encoding.BinaryMarshaler.
diff --git a/vendor/github.com/google/uuid/version1.go b/vendor/github.com/google/uuid/version1.go
index 199a1ac65..463109629 100644
--- a/vendor/github.com/google/uuid/version1.go
+++ b/vendor/github.com/google/uuid/version1.go
@@ -17,12 +17,6 @@ import (
//
// In most cases, New should be used.
func NewUUID() (UUID, error) {
- nodeMu.Lock()
- if nodeID == zeroID {
- setNodeInterface("")
- }
- nodeMu.Unlock()
-
var uuid UUID
now, seq, err := GetTime()
if err != nil {
@@ -38,7 +32,13 @@ func NewUUID() (UUID, error) {
binary.BigEndian.PutUint16(uuid[4:], timeMid)
binary.BigEndian.PutUint16(uuid[6:], timeHi)
binary.BigEndian.PutUint16(uuid[8:], seq)
+
+ nodeMu.Lock()
+ if nodeID == zeroID {
+ setNodeInterface("")
+ }
copy(uuid[10:], nodeID[:])
+ nodeMu.Unlock()
return uuid, nil
}
diff --git a/vendor/github.com/google/uuid/version4.go b/vendor/github.com/google/uuid/version4.go
index 84af91c9f..c110465db 100644
--- a/vendor/github.com/google/uuid/version4.go
+++ b/vendor/github.com/google/uuid/version4.go
@@ -27,8 +27,13 @@ func New() UUID {
// equivalent to the odds of creating a few tens of trillions of UUIDs in a
// year and having one duplicate.
func NewRandom() (UUID, error) {
+ return NewRandomFromReader(rander)
+}
+
+// NewRandomFromReader returns a UUID based on bytes read from a given io.Reader.
+func NewRandomFromReader(r io.Reader) (UUID, error) {
var uuid UUID
- _, err := io.ReadFull(rander, uuid[:])
+ _, err := io.ReadFull(r, uuid[:])
if err != nil {
return Nil, err
}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index f3d939122..77cfa9c3f 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -95,7 +95,7 @@ github.com/containers/common/pkg/retry
github.com/containers/common/pkg/seccomp
github.com/containers/common/pkg/sysinfo
github.com/containers/common/version
-# github.com/containers/conmon v2.0.19+incompatible
+# github.com/containers/conmon v2.0.20+incompatible
github.com/containers/conmon/runner/config
# github.com/containers/image/v5 v5.5.2
github.com/containers/image/v5/copy
@@ -303,7 +303,7 @@ github.com/golang/protobuf/ptypes/timestamp
github.com/google/gofuzz
# github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf
github.com/google/shlex
-# github.com/google/uuid v1.1.1
+# github.com/google/uuid v1.1.2
github.com/google/uuid
# github.com/gorilla/mux v1.7.4
github.com/gorilla/mux