diff --git a/docs/source/markdown/options/image-volume.md b/docs/source/markdown/options/image-volume.md index 878461ac68..56a123f68e 100644 --- a/docs/source/markdown/options/image-volume.md +++ b/docs/source/markdown/options/image-volume.md @@ -1,8 +1,12 @@ ####> This option file is used in: -####> podman create, run +####> podman podman-container.unit.5.md.in, create, run ####> If file is edited, make sure the changes ####> are applicable to all of those. +<< if is_quadlet >> +### `ImageVolume=mode` +<< else >> #### **--image-volume**=**bind** | *tmpfs* | *ignore* +<< endif >> Tells Podman how to handle the builtin image volumes. Default is **bind**. diff --git a/docs/source/markdown/podman-container.unit.5.md.in b/docs/source/markdown/podman-container.unit.5.md.in index 63727da340..82908718ab 100644 --- a/docs/source/markdown/podman-container.unit.5.md.in +++ b/docs/source/markdown/podman-container.unit.5.md.in @@ -76,6 +76,7 @@ Valid options for `[Container]` are listed below: | HostName=example.com | --hostname example.com | | HttpProxy=true | --http-proxy=true | | Image=ubi8 | Image specification - ubi8 | +| ImageVolume=tmpfs | --image-volume tmpfs | | IP=192.5.0.1 | --ip 192.5.0.1 | | IP6=2001:db8::1 | --ip6 2001:db8::1 | | Label="XYZ" | --label "XYZ" | @@ -222,6 +223,8 @@ Special Cases: * If the `name` of the image ends with `.image`, Quadlet will use the image pulled by the corresponding `.image` file, and the generated systemd service contains a dependency on the `$name-image.service` (or the service name set in the .image file). Note that the corresponding `.image` file must exist. * If the `name` of the image ends with `.build`, Quadlet will use the image built by the corresponding `.build` file, and the generated systemd service contains a dependency on the `$name-build.service`. Note: the corresponding `.build` file must exist. +@@option quadlet:image-volume + @@option quadlet:ip @@option quadlet:ip6 diff --git a/docs/source/markdown/podman-systemd.unit.5.md b/docs/source/markdown/podman-systemd.unit.5.md index ca5e5fedfa..8d9499eabb 100644 --- a/docs/source/markdown/podman-systemd.unit.5.md +++ b/docs/source/markdown/podman-systemd.unit.5.md @@ -385,6 +385,7 @@ Valid options for `[Container]` are listed below: | HostName=example.com | --hostname example.com | | HttpProxy=true | --http-proxy=true | | Image=ubi8 | Image specification - ubi8 | +| ImageVolume=tmpfs | --image-volume tmpfs | | IP=192.5.0.1 | --ip 192.5.0.1 | | IP6=2001:db8::1 | --ip6 2001:db8::1 | | Label="XYZ" | --label "XYZ" | @@ -721,6 +722,11 @@ Special Cases: * If the `name` of the image ends with `.image`, Quadlet will use the image pulled by the corresponding `.image` file, and the generated systemd service contains a dependency on the `$name-image.service` (or the service name set in the .image file). Note that the corresponding `.image` file must exist. * If the `name` of the image ends with `.build`, Quadlet will use the image built by the corresponding `.build` file, and the generated systemd service contains a dependency on the `$name-build.service`. Note: the corresponding `.build` file must exist. +### `ImageVolume=` + +Tells Podman how to handle the builtin image volumes. Default is **bind**. +Equivalent to the Podman `--image-volume` option. + ### `IP=` Specify a static IPv4 address for the container, for example **10.88.64.128**. diff --git a/pkg/systemd/quadlet/quadlet.go b/pkg/systemd/quadlet/quadlet.go index 8cf739700c..d83958c9dd 100644 --- a/pkg/systemd/quadlet/quadlet.go +++ b/pkg/systemd/quadlet/quadlet.go @@ -119,6 +119,7 @@ const ( KeyIgnoreFile = "IgnoreFile" KeyImage = "Image" KeyImageTag = "ImageTag" + KeyImageVolume = "ImageVolume" KeyInterfaceName = "InterfaceName" KeyInternal = "Internal" KeyIP = "IP" @@ -289,6 +290,7 @@ var ( KeyIP6: true, KeyIP: true, KeyImage: true, + KeyImageVolume: true, KeyLabel: true, KeyLogDriver: true, KeyLogOpt: true, @@ -700,6 +702,7 @@ func ConvertContainer(container *parser.UnitFile, unitsInfoMap map[string]*UnitI KeyMemory: "--memory", KeyRetry: "--retry", KeyRetryDelay: "--retry-delay", + KeyImageVolume: "--image-volume", } lookupAndAddString(container, ContainerGroup, stringKeys, podman) diff --git a/test/e2e/quadlet/image-volume.container b/test/e2e/quadlet/image-volume.container new file mode 100644 index 0000000000..17b3707e52 --- /dev/null +++ b/test/e2e/quadlet/image-volume.container @@ -0,0 +1,6 @@ +## assert-podman-final-args localhost/imagename +## assert-podman-args --image-volume tmpfs + +[Container] +Image=localhost/imagename +ImageVolume=tmpfs diff --git a/test/e2e/quadlet_test.go b/test/e2e/quadlet_test.go index 877d0f7e33..f434909b9a 100644 --- a/test/e2e/quadlet_test.go +++ b/test/e2e/quadlet_test.go @@ -947,6 +947,7 @@ BOGUS=foo Entry("hostname.container", "hostname.container"), Entry("idmapping.container", "idmapping.container"), Entry("image.container", "image.container"), + Entry("image-volume.container", "image-volume.container"), Entry("install.container", "install.container"), Entry("ip.container", "ip.container"), Entry("label.container", "label.container"),