Skip to content

Commit

Permalink
Merge pull request #19902 from giuseppe/fix-pod-run-with-mounts
Browse files Browse the repository at this point in the history
pod: fix duplicate volumes from containers.conf
  • Loading branch information
rhatdan committed Sep 9, 2023
2 parents 7bf9f30 + fbbad04 commit 745201e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/podman/pods/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func init() {
flags := createCommand.Flags()
flags.SetInterspersed(false)
common.DefineCreateDefaults(&infraOptions)
// these settings are not applicable to pod create since they are per-container
// and they will end up being duplicated for each container in the pod.
infraOptions.Volume = nil
infraOptions.Mount = nil
common.DefineCreateFlags(createCommand, &infraOptions, entities.InfraMode)
common.DefineNetFlags(createCommand)

Expand Down
18 changes: 18 additions & 0 deletions test/system/200-pod.bats
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,24 @@ function teardown() {
}


@test "podman pod create - custom volumes" {
skip_if_remote "CONTAINERS_CONF_OVERRIDE only affects server side"
image="i.do/not/exist:image"
tmpdir=$PODMAN_TMPDIR/pod-test
mkdir -p $tmpdir
containersconf=$tmpdir/containers.conf
cat >$containersconf <<EOF
[containers]
volumes = ["/tmp:/foobar"]
EOF

CONTAINERS_CONF_OVERRIDE=$containersconf run_podman pod create
podid="$output"

CONTAINERS_CONF_OVERRIDE=$containersconf run_podman create --pod $podid $IMAGE grep foobar /proc/mounts
}


@test "podman pod create - custom infra image" {
skip_if_remote "CONTAINERS_CONF_OVERRIDE only affects server side"
image="i.do/not/exist:image"
Expand Down

0 comments on commit 745201e

Please sign in to comment.