As podman is actively promoted by fedora and suse, im getting curious how to build a simple docker image with multiarch
Let use a simple Dockerfile of custom debian image
FROM debian:sid-slim
ARG USER=debian
ARG SUDOERS="$USER ALL=(ALL) NOPASSWD:ALL"
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
ENV DEBIAN_FRONTEND=noninteractive
ENV CONTAINERUSER=$USER
ENV TZ=Asia/Jakarta
ENV HOME=/home/$CONTAINERUSER
COPY sudo_lecture.txt /etc/sudo_lecture.txt
RUN apt update && \
apt install -y --no-install-recommends eatmydata openssl sudo ca-certificates tzdata curl tini ncdu locales && \
ln -s /usr/bin/eatmydata /usr/local/bin/apt && \
apt clean && \
rm -rf /var/lib/apt/lists/* && \
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen && \
echo "Defaults lecture=always" >> /etc/sudoers && \
echo "Defaults lecture_file=/etc/sudo_lecture.txt" >> /etc/sudoers && \
echo $SUDOERS >> /etc/sudoers && \
useradd -u 1000 -U -d /home/$USER -s /bin/bash -p $(echo $USER | openssl passwd -1 -stdin) $USER -m -d /home/$USER && \
gpasswd -a $USER sudo && \
mkdir -p /home/$CONTAINERUSER/.local/bin && \
mkdir -p /home/$CONTAINERUSER/.local/lib && \
chown -R $CONTAINERUSER:$CONTAINERUSER /home/$CONTAINERUSER
ENV PATH="/home/$CONTAINERUSER/.local/bin:/home/$CONTAINERUSER/.local/lib:/home/$CONTAINERUSER/.local/lib:$PATH"
WORKDIR $HOME
USER $CONTAINERUSER
ENTRYPOINT ["/usr/bin/tini", "-g", "--"]
CMD ["/bin/bash"]
First lets try simple build
podman build -t debian:local -f Dockerfile .
This is a standard and straigtforward command. Now the multiarch part
$ docker buildx build --push --platform linux/arm64,linux/amd64 -t repo/imagename:tag .
In comparison
$ podman build --platform=linux/amd64,linux/arm64 --manifest repo/imagename:tag .
Both need qemu-user-static
to work, or building cross architecture. or running binfmt support via docker
# docker run --rm --privileged martadinata666/docker-binfmt-qemu:sid