Commit da72e2b
fix(gitlab): fix nested-container DNS by propagating netns and mounting containers.conf
Root cause (confirmed live on s390x runner):
podman build RUN steps run inside a nested container created by inner
Podman inside the docker executor container. Inner Podman (using
Netavark) creates a new bridge for these build-step containers, but the
privileged-but-bridge-networked outer container has no working iptables/
nftables NAT, so packets from the 10.88.0.0/16 bridge subnet can never
reach the DNS servers. The inner containers' /etc/resolv.conf had the
correct nameservers written but DNS queries timed out because they could
not be routed.
The previous chmod 644 and dns_servers fixes correctly configured the
outer executor container but did not propagate into the nested build-step
containers.
Fixes applied:
1. Add netns = "host" to /etc/containers/containers.conf.
When the file is bind-mounted into the executor container (see #3),
inner Podman reads this and creates all build-step containers sharing
the outer container's network namespace instead of a new bridge.
They inherit the working resolv.conf with no NAT required.
2. Guarantee /etc/containers/containers.conf exists before runner
registration even when DNS detection finds no upstream servers, so
the bind mount in #3 always has a real file to attach to.
3. Add --docker-volumes to the runner registration so that every
executor container gets the host's containers.conf bind-mounted at
/etc/containers/containers.conf:ro. This makes the nested inner
Podman pick up both dns_servers and netns = "host" automatically,
without any change to the CI job Dockerfile or podman build invocation.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent b9f6434 commit da72e2b
1 file changed
Lines changed: 51 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
| 46 | + | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
63 | 71 | | |
64 | | - | |
65 | | - | |
| 72 | + | |
| 73 | + | |
66 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
67 | 85 | | |
68 | 86 | | |
69 | 87 | | |
| |||
90 | 108 | | |
91 | 109 | | |
92 | 110 | | |
| 111 | + | |
93 | 112 | | |
94 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
95 | 140 | | |
96 | 141 | | |
97 | 142 | | |
| |||
102 | 147 | | |
103 | 148 | | |
104 | 149 | | |
105 | | - | |
| 150 | + | |
| 151 | + | |
106 | 152 | | |
107 | 153 | | |
108 | 154 | | |
| |||
0 commit comments