Skip to content

Commit 428c854

Browse files
Merge pull request #26932 from ogajduse/feature/quadlet-httpproxy-26925
quadlet: add HttpProxy option for Container sections
2 parents 39072f7 + c65fd9a commit 428c854

File tree

5 files changed

+27
-0
lines changed

5 files changed

+27
-0
lines changed

docs/source/markdown/podman-systemd.unit.5.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ Valid options for `[Container]` are listed below:
338338
| HealthStartupTimeout=1m33s | --health-startup-timeout=1m33s |
339339
| HealthTimeout=20s | --health-timeout=20s |
340340
| HostName=example.com | --hostname example.com |
341+
| HttpProxy=true | --http-proxy=true |
341342
| Image=ubi8 | Image specification - ubi8 |
342343
| IP=192.5.0.1 | --ip 192.5.0.1 |
343344
| IP6=2001:db8::1 | --ip6 2001:db8::1 |
@@ -647,6 +648,15 @@ Equivalent to the Podman `--health-timeout` option.
647648
Sets the host name that is available inside the container.
648649
Equivalent to the Podman `--hostname` option.
649650

651+
### `HttpProxy=`
652+
653+
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.
654+
655+
Set to `true` to enable proxy inheritance (default Podman behavior) or `false` to disable it.
656+
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.
657+
658+
Equivalent to the Podman `--http-proxy` option.
659+
650660
### `Image=`
651661

652662
The image to run in the container.

pkg/systemd/quadlet/quadlet.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ const (
109109
KeyHealthStartupTimeout = "HealthStartupTimeout"
110110
KeyHealthTimeout = "HealthTimeout"
111111
KeyHostName = "HostName"
112+
KeyHttpProxy = "HttpProxy"
112113
KeyImage = "Image"
113114
KeyImageTag = "ImageTag"
114115
KeyInterfaceName = "InterfaceName"
@@ -274,6 +275,7 @@ var (
274275
KeyHealthStartupTimeout: true,
275276
KeyHealthTimeout: true,
276277
KeyHostName: true,
278+
KeyHttpProxy: true,
277279
KeyIP6: true,
278280
KeyIP: true,
279281
KeyImage: true,
@@ -676,6 +678,7 @@ func ConvertContainer(container *parser.UnitFile, isUser bool, unitsInfoMap map[
676678
boolKeys := map[string]string{
677679
KeyRunInit: "--init",
678680
KeyEnvironmentHost: "--env-host",
681+
KeyHttpProxy: "--http-proxy",
679682
KeyReadOnlyTmpfs: "--read-only-tmpfs",
680683
}
681684
lookupAndAddBoolean(container, ContainerGroup, boolKeys, podman)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## assert-podman-final-args localhost/imagename
2+
## assert-podman-args --http-proxy=false
3+
4+
[Container]
5+
Image=localhost/imagename
6+
HttpProxy=false
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## assert-podman-final-args localhost/imagename
2+
## assert-podman-args --http-proxy
3+
4+
[Container]
5+
Image=localhost/imagename
6+
HttpProxy=true

test/e2e/quadlet_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,8 @@ BOGUS=foo
901901
Entry("group-add.container", "group-add.container"),
902902
Entry("health.container", "health.container"),
903903
Entry("host.container", "host.container"),
904+
Entry("httpproxy-false.container", "httpproxy-false.container"),
905+
Entry("httpproxy-true.container", "httpproxy-true.container"),
904906
Entry("hostname.container", "hostname.container"),
905907
Entry("idmapping.container", "idmapping.container"),
906908
Entry("image.container", "image.container"),

0 commit comments

Comments
 (0)