Candyboober
03/08/2025, 7:46 PM--privileged
flag, I added CAP_SYS_ADMIN
cap, I tried changing a storage to vfs
, and turning a rootful mode on Podman podman machine --set rootful
.
if somebody has experienced Im happy to see your input.
my next step to try running it in linux just to validate it's pure Mac problem with layer fs or something.
but running it on Mac is quite important for dev experience + the company doesn't give linux machines anymore due to security team requirements.Mukundhan Sampath
03/08/2025, 8:46 PMCandyboober
03/08/2025, 9:24 PMpackage main
import (
"context"
"fmt"
"os"
"github.com/containers/buildah/define"
"github.com/containers/buildah/imagebuildah"
"github.com/containers/storage"
"github.com/containers/storage/pkg/reexec"
)
func main() {
reexec.Init()
buildStoreOptions, err := storage.DefaultStoreOptions()
ifErr(err)
buildStore, err := storage.GetStore(buildStoreOptions)
ifErr(err)
id, ref, err := imagebuildah.BuildDockerfiles(context.Background(), buildStore, define.BuildOptions{
Registry: "jopa",
Output: "jopa2",
Out: os.Stdout,
Err: os.Stderr,
ReportWriter: os.Stdout,
IgnoreFile: "./.dockerignore",
}, "./Dockerfile")
ifErr(err)
fmt.Println(id)
fmt.Println(ref)
}
func ifErr(err error) {
if err != nil {
panic(err)
}
}
Candyboober
03/08/2025, 9:25 PMFROM ubuntu:latest
ENV _BUILDAH_STARTED_IN_USERNS="" BUILDAH_ISOLATION=chroot
RUN apt-get update
RUN apt-get -y install buildah bats btrfs-progs git go-md2man golang libapparmor-dev libglib2.0-dev libgpgme11-dev libseccomp-dev libselinux1-dev make runc skopeo libbtrfs-dev wget fuse-overlayfs && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /etc/containers && \
mkdir -p /var/lib/shared/overlay-images /var/lib/shared/overlay-layers && \
touch /var/lib/shared/overlay-images/images.lock && \
touch /var/lib/shared/overlay-layers/layers.lock
RUN wget -P /tmp <https://go.dev/dl/go1.24.1.linux-arm64.tar.gz>
RUN tar -C /usr/local -xzf "/tmp/go1.24.1.linux-arm64.tar.gz"
RUN rm "/tmp/go1.24.1.linux-arm64.tar.gz"
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH
RUN mkdir -p /etc/containers/ && touch /etc/containers/registries.conf && echo 'unqualified-search-registries=["<http://docker.io|docker.io>"]' > /etc/containers/registries.conf
COPY policy.json /etc/containers/policy.json
COPY storage.conf /etc/containers/storage.conf
COPY . .
RUN go build -o /go/app ./cmd/tt/t.go
CMD /go/app
Candyboober
03/08/2025, 9:26 PM<http://Dockerfile.tt|Dockerfile.tt>
is what Im trying to run
https://github.com/treenq/treenq/tree/buildah-playMukundhan Sampath
03/08/2025, 9:42 PM2025-03-08 22:41:50 panic: mount /var/lib/containers/storage/overlay:/var/lib/containers/storage/overlay, flags: 0x1000: operation not permitted
2025-03-08 22:41:50
2025-03-08 22:41:50 goroutine 1 [running]:
2025-03-08 22:41:50 main.ifErr(...)
2025-03-08 22:41:50 /go/cmd/tt/t.go:36
2025-03-08 22:41:50 main.main()
2025-03-08 22:41:50 /go/cmd/tt/t.go:19 +0x274
is this the issue you are also facing ?Candyboober
03/08/2025, 10:07 PM--privileged
it will complain on missing CAP_SYS_ADMIN
,Candyboober
03/08/2025, 10:23 PMunshare.MaybeReexecUsingUserNamespace(false)
callMukundhan Sampath
03/08/2025, 10:28 PMWriting manifest to image destination
[1/4] STEP 2/8: WORKDIR /app
panic: building at STEP "WORKDIR /app": time="2025-03-08T22:26:54Z" level=warning msg="Failed to read CAP_SYS_ADMIN presence for the current process"
time="2025-03-08T22:26:54Z" level=warning msg="Failed to read current user namespace mappings"
panic: kernel does not support overlay fs: unable to create kernel-style whiteout: operation not permitted
goroutine 1 [running]:
main.ifErr(...)
/go/cmd/tt/t.go:36
main.main()
/go/cmd/tt/t.go:19 +0x274
goroutine 1 [running]:
main.ifErr(...)
/go/cmd/tt/t.go:36
main.main()
/go/cmd/tt/t.go:29 +0x268
Candyboober
03/08/2025, 10:33 PMbrew install macfuse
in order to support layerfs (I barely understand what it does, now it goes right into my read list).
to run it I did podman run --net=host --security-opt label=disable --security-opt seccomp=unconfined localhost/tt
or docker
instead of Podman is fine too (podman requires host as a repo for the images, use for docker it's just tt instead of localhost/tt).
this go app build an image, I just wanted to learn how can I build a go app that can build the others docker containers, potentially extending it to build packs too.
it has only 1 useful line is
id, ref, err := imagebuildah.BuildDockerfiles(context.Background(), buildStore, define.BuildOptions{
Registry: "jopa",
Output: "jopa2",
Out: os.Stdout,
Err: os.Stderr,
ReportWriter: os.Stdout,
IgnoreFile: "./.dockerignore",
}, "./Dockerfile")
simply saying it does docker ubild
specifying docker ignore and a Dockerfiles, also redirecting stdout to the console. I don't know what most of the fields do, I also need to learn it.Mukundhan Sampath
03/08/2025, 10:37 PMClemens Jütte
03/09/2025, 7:51 PMCandyboober
03/10/2025, 8:38 AMdefault
branch and say "pls roll it, that much memory and cpu I need".
I considered kaniko too, but find it inconvinient. we also need to choose between dockerfile and buildpacks in this scenarioClemens Jütte
03/12/2025, 12:20 PMCandyboober
03/12/2025, 12:21 PMClemens Jütte
03/13/2025, 1:54 PMCandyboober
03/13/2025, 1:56 PMClemens Jütte
03/14/2025, 9:14 AMCandyboober
03/14/2025, 9:19 AMCandyboober
03/24/2025, 9:31 AMCandyboober
03/24/2025, 9:32 AMClemens Jütte
03/25/2025, 9:10 AMClemens Jütte
03/25/2025, 9:11 AMCandyboober
03/25/2025, 9:15 AMMukundhan Sampath
03/25/2025, 10:13 AM