mirror of
https://github.com/containers/podman.git
synced 2025-06-26 12:56:45 +08:00
Merge pull request #19902 from giuseppe/fix-pod-run-with-mounts
pod: fix duplicate volumes from containers.conf
This commit is contained in:
@ -62,6 +62,10 @@ func init() {
|
|||||||
flags := createCommand.Flags()
|
flags := createCommand.Flags()
|
||||||
flags.SetInterspersed(false)
|
flags.SetInterspersed(false)
|
||||||
common.DefineCreateDefaults(&infraOptions)
|
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.DefineCreateFlags(createCommand, &infraOptions, entities.InfraMode)
|
||||||
common.DefineNetFlags(createCommand)
|
common.DefineNetFlags(createCommand)
|
||||||
|
|
||||||
|
@ -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" {
|
@test "podman pod create - custom infra image" {
|
||||||
skip_if_remote "CONTAINERS_CONF_OVERRIDE only affects server side"
|
skip_if_remote "CONTAINERS_CONF_OVERRIDE only affects server side"
|
||||||
image="i.do/not/exist:image"
|
image="i.do/not/exist:image"
|
||||||
|
Reference in New Issue
Block a user