Commit 7ab2f36
running MCV without --privileged
Problem:
MCV uses buildah internally to build/push OCI cache images. Buildah traditionally
requires `--privileged` because it needs to mount overlay filesystems and run as root.
This is a security concern in production Kubernetes and CI environments.
What changed in the Containerfile
1. Storage driver: FUSE/overlay → VFS (redhat-et#173)
driver="vfs"
FUSE-overlayfs requires either --privileged or CAP_SYS_ADMIN + /dev/fuse access.
VFS is a naive copy-based storage driver that needs no special kernel capabilities.
It's slower (copies instead of overlays), but MCV only builds small single-layer
cache images, so the performance difference is negligible.
2. Non-root user (UID/GID 1000)
```
RUN groupadd -g 1000 appgroup && \
useradd -u 1000 -g appgroup -m -s /bin/bash appuser
USER appuser
```
Running as root inside the container is unnecessary and a security risk. The
fixed UID/GID 1000 also makes volume mount permissions predictable.
Runtime flags: Podman vs Docker
Podman:
`podman run -v /path/to/cache:/tests:Z,U <image> ...`
- :Z — relabels the volume for SELinux (private to this container)
- :U — remaps the volume ownership to match the in-container user (UID 1000).
Podman runs rootless with user namespaces, so the host UID and container UID
differ. :U bridges that gap so appuser can read/write the mount.
You only need :Z,U on volumes the container needs to write to (the cache output
directory). Read-only mounts like model files only need :Z (or :ro,Z).
Docker:
```
docker run --user $(id -u):$(id -g) \
--security-opt seccomp=unconfined \
--security-opt apparmor=unconfined \
-v /path/to/cache:/tests:Z \
<image> ...
```
- `--user $(id -u):$(id -g)` — Docker doesn't have Podman's user-namespace
remapping, so you explicitly run as your host UID/GID to match volume ownership.
Without this, the container runs as UID 1000 (appuser) which may not own the
host-side mount.
- `--security-opt seccomp=unconfined` — buildah makes syscalls (like mount,
unshare) that Docker's default seccomp profile blocks. Disabling seccomp allows
these without granting full --privileged.
- `--security-opt apparmor=unconfined` — on Ubuntu (base container), AppArmor's
default Docker profile also blocks some of buildah's mount/namespace operations.
Disabling it is the minimal escalation needed.
- `:Z` — SELinux relabeling, same as Podman. No :U needed because --user handles
ownership directly.
Why the difference
Podman is rootless-native — it uses user namespaces automatically, so :U remaps
ownership transparently. Docker doesn't do user-namespace remapping by default,
so you need --user to align UIDs, and --security-opt to relax seccomp/AppArmor
enough for buildah's syscalls without going full --privileged.
What you're NOT granting
Neither approach uses --privileged. The container does NOT get:
- Full device access
- CAP_SYS_ADMIN
- Host PID/network namespace
- Write access to /dev, /proc, /sys
It's a targeted relaxation: let buildah do its mounts and namespace operations,
nothing more.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>1 parent 6270ecc commit 7ab2f36
5 files changed
Lines changed: 402 additions & 67 deletions
File tree
- .github/workflows
- mcv
- docs
- images
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
| 32 | + | |
34 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
35 | 83 | | |
36 | 84 | | |
37 | 85 | | |
| |||
110 | 158 | | |
111 | 159 | | |
112 | 160 | | |
| 161 | + | |
113 | 162 | | |
114 | 163 | | |
115 | 164 | | |
| |||
552 | 601 | | |
553 | 602 | | |
554 | 603 | | |
555 | | - | |
556 | | - | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
557 | 609 | | |
558 | 610 | | |
559 | 611 | | |
560 | 612 | | |
561 | 613 | | |
562 | 614 | | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
563 | 620 | | |
564 | 621 | | |
565 | 622 | | |
566 | 623 | | |
567 | 624 | | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
568 | 630 | | |
569 | 631 | | |
570 | 632 | | |
571 | 633 | | |
572 | 634 | | |
573 | 635 | | |
574 | 636 | | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
575 | 653 | | |
576 | 654 | | |
577 | 655 | | |
| |||
596 | 674 | | |
597 | 675 | | |
598 | 676 | | |
599 | | - | |
600 | | - | |
| 677 | + | |
| 678 | + | |
601 | 679 | | |
602 | 680 | | |
603 | 681 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
44 | 47 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
48 | 51 | | |
49 | | - | |
| 52 | + | |
| 53 | + | |
50 | 54 | | |
51 | 55 | | |
52 | 56 | | |
| |||
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
64 | | - | |
| 68 | + | |
65 | 69 | | |
66 | | - | |
| 70 | + | |
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
70 | | - | |
71 | | - | |
| 74 | + | |
| 75 | + | |
72 | 76 | | |
73 | 77 | | |
74 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
75 | 94 | | |
76 | 95 | | |
77 | 96 | | |
| |||
82 | 101 | | |
83 | 102 | | |
84 | 103 | | |
85 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
86 | 107 | | |
87 | | - | |
88 | 108 | | |
89 | | - | |
| 109 | + | |
| 110 | + | |
90 | 111 | | |
91 | | - | |
| 112 | + | |
| 113 | + | |
92 | 114 | | |
93 | 115 | | |
94 | 116 | | |
| |||
101 | 123 | | |
102 | 124 | | |
103 | 125 | | |
104 | | - | |
| 126 | + | |
105 | 127 | | |
106 | 128 | | |
107 | 129 | | |
| |||
116 | 138 | | |
117 | 139 | | |
118 | 140 | | |
119 | | - | |
120 | | - | |
| 141 | + | |
| 142 | + | |
121 | 143 | | |
122 | 144 | | |
123 | 145 | | |
| |||
130 | 152 | | |
131 | 153 | | |
132 | 154 | | |
133 | | - | |
| 155 | + | |
134 | 156 | | |
135 | 157 | | |
136 | 158 | | |
| |||
150 | 172 | | |
151 | 173 | | |
152 | 174 | | |
153 | | - | |
| 175 | + | |
154 | 176 | | |
155 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
156 | 181 | | |
| 182 | + | |
| 183 | + | |
157 | 184 | | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
164 | 188 | | |
165 | 189 | | |
166 | 190 | | |
167 | 191 | | |
168 | 192 | | |
169 | 193 | | |
170 | | - | |
| 194 | + | |
171 | 195 | | |
172 | 196 | | |
173 | 197 | | |
174 | 198 | | |
175 | 199 | | |
176 | | - | |
177 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
178 | 221 | | |
179 | 222 | | |
180 | 223 | | |
| |||
187 | 230 | | |
188 | 231 | | |
189 | 232 | | |
190 | | - | |
| 233 | + | |
191 | 234 | | |
192 | | - | |
| 235 | + | |
193 | 236 | | |
194 | 237 | | |
195 | 238 | | |
196 | 239 | | |
197 | 240 | | |
198 | | - | |
199 | | - | |
| 241 | + | |
| 242 | + | |
200 | 243 | | |
201 | 244 | | |
202 | 245 | | |
| |||
0 commit comments