mirror of
https://github.com/containers/podman.git
synced 2025-11-29 17:48:05 +08:00
quadlet: add HttpProxy option for Container sections
Add support for HttpProxy key in quadlet Container sections to control proxy environment variable inheritance during image pulls and builds. - HttpProxy=true enables proxy inheritance (default podman behavior) - HttpProxy=false disables proxy inheritance - When omitted, uses podman's default behavior This addresses the need for declarative proxy configuration in IPv6-only networks and other scenarios where proxy settings need to be controlled at the container level without manual workarounds. Fixes #26925 Signed-off-by: Ondřej Gajdušek <ogajduse@redhat.com>
This commit is contained in:
@@ -338,6 +338,7 @@ Valid options for `[Container]` are listed below:
|
|||||||
| HealthStartupTimeout=1m33s | --health-startup-timeout=1m33s |
|
| HealthStartupTimeout=1m33s | --health-startup-timeout=1m33s |
|
||||||
| HealthTimeout=20s | --health-timeout=20s |
|
| HealthTimeout=20s | --health-timeout=20s |
|
||||||
| HostName=example.com | --hostname example.com |
|
| HostName=example.com | --hostname example.com |
|
||||||
|
| HttpProxy=true | --http-proxy=true |
|
||||||
| Image=ubi8 | Image specification - ubi8 |
|
| Image=ubi8 | Image specification - ubi8 |
|
||||||
| IP=192.5.0.1 | --ip 192.5.0.1 |
|
| IP=192.5.0.1 | --ip 192.5.0.1 |
|
||||||
| IP6=2001:db8::1 | --ip6 2001:db8::1 |
|
| IP6=2001:db8::1 | --ip6 2001:db8::1 |
|
||||||
@@ -647,6 +648,15 @@ Equivalent to the Podman `--health-timeout` option.
|
|||||||
Sets the host name that is available inside the container.
|
Sets the host name that is available inside the container.
|
||||||
Equivalent to the Podman `--hostname` option.
|
Equivalent to the Podman `--hostname` option.
|
||||||
|
|
||||||
|
### `HttpProxy=`
|
||||||
|
|
||||||
|
Controls whether proxy environment variables (http_proxy, https_proxy, ftp_proxy, no_proxy) are passed from the Podman process into the container during image pulls and builds.
|
||||||
|
|
||||||
|
Set to `true` to enable proxy inheritance (default Podman behavior) or `false` to disable it.
|
||||||
|
This option is particularly useful on systems that require proxy configuration for internet access but don't want proxy settings passed to the container runtime.
|
||||||
|
|
||||||
|
Equivalent to the Podman `--http-proxy` option.
|
||||||
|
|
||||||
### `Image=`
|
### `Image=`
|
||||||
|
|
||||||
The image to run in the container.
|
The image to run in the container.
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ const (
|
|||||||
KeyHealthStartupTimeout = "HealthStartupTimeout"
|
KeyHealthStartupTimeout = "HealthStartupTimeout"
|
||||||
KeyHealthTimeout = "HealthTimeout"
|
KeyHealthTimeout = "HealthTimeout"
|
||||||
KeyHostName = "HostName"
|
KeyHostName = "HostName"
|
||||||
|
KeyHttpProxy = "HttpProxy"
|
||||||
KeyImage = "Image"
|
KeyImage = "Image"
|
||||||
KeyImageTag = "ImageTag"
|
KeyImageTag = "ImageTag"
|
||||||
KeyInterfaceName = "InterfaceName"
|
KeyInterfaceName = "InterfaceName"
|
||||||
@@ -274,6 +275,7 @@ var (
|
|||||||
KeyHealthStartupTimeout: true,
|
KeyHealthStartupTimeout: true,
|
||||||
KeyHealthTimeout: true,
|
KeyHealthTimeout: true,
|
||||||
KeyHostName: true,
|
KeyHostName: true,
|
||||||
|
KeyHttpProxy: true,
|
||||||
KeyIP6: true,
|
KeyIP6: true,
|
||||||
KeyIP: true,
|
KeyIP: true,
|
||||||
KeyImage: true,
|
KeyImage: true,
|
||||||
@@ -676,6 +678,7 @@ func ConvertContainer(container *parser.UnitFile, isUser bool, unitsInfoMap map[
|
|||||||
boolKeys := map[string]string{
|
boolKeys := map[string]string{
|
||||||
KeyRunInit: "--init",
|
KeyRunInit: "--init",
|
||||||
KeyEnvironmentHost: "--env-host",
|
KeyEnvironmentHost: "--env-host",
|
||||||
|
KeyHttpProxy: "--http-proxy",
|
||||||
KeyReadOnlyTmpfs: "--read-only-tmpfs",
|
KeyReadOnlyTmpfs: "--read-only-tmpfs",
|
||||||
}
|
}
|
||||||
lookupAndAddBoolean(container, ContainerGroup, boolKeys, podman)
|
lookupAndAddBoolean(container, ContainerGroup, boolKeys, podman)
|
||||||
|
|||||||
6
test/e2e/quadlet/httpproxy-false.container
Normal file
6
test/e2e/quadlet/httpproxy-false.container
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
## assert-podman-final-args localhost/imagename
|
||||||
|
## assert-podman-args --http-proxy=false
|
||||||
|
|
||||||
|
[Container]
|
||||||
|
Image=localhost/imagename
|
||||||
|
HttpProxy=false
|
||||||
6
test/e2e/quadlet/httpproxy-true.container
Normal file
6
test/e2e/quadlet/httpproxy-true.container
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
## assert-podman-final-args localhost/imagename
|
||||||
|
## assert-podman-args --http-proxy
|
||||||
|
|
||||||
|
[Container]
|
||||||
|
Image=localhost/imagename
|
||||||
|
HttpProxy=true
|
||||||
@@ -901,6 +901,8 @@ BOGUS=foo
|
|||||||
Entry("group-add.container", "group-add.container"),
|
Entry("group-add.container", "group-add.container"),
|
||||||
Entry("health.container", "health.container"),
|
Entry("health.container", "health.container"),
|
||||||
Entry("host.container", "host.container"),
|
Entry("host.container", "host.container"),
|
||||||
|
Entry("httpproxy-false.container", "httpproxy-false.container"),
|
||||||
|
Entry("httpproxy-true.container", "httpproxy-true.container"),
|
||||||
Entry("hostname.container", "hostname.container"),
|
Entry("hostname.container", "hostname.container"),
|
||||||
Entry("idmapping.container", "idmapping.container"),
|
Entry("idmapping.container", "idmapping.container"),
|
||||||
Entry("image.container", "image.container"),
|
Entry("image.container", "image.container"),
|
||||||
|
|||||||
Reference in New Issue
Block a user