Why Podman Instead of Docker?
While Docker is the standard for containerized workflows and has stronger integration with CI/CD platforms (e.g., GitHub Actions, GitLab CI, Jenkins), Podman offers specific advantages for local AOSP builds:
- Rootless by default – safer and easier for individual developers, no daemon or
sudo
needed - Correct file ownership – container-created files retain the correct host user ownership
- Fewer permission issues – avoids volume-mount problems and UID mismatches common in Docker
- Daemonless – containers run as standalone user processes (no
dockerd
), easier to debug locally
Podman excels in local developer environments where simplicity, file permission consistency, and isolation matter more than CI platform compatibility. If your focus is on building AOSP efficiently as a developer — Podman is often the better fit.
- Install Podman
sudo apt update
sudo apt install -y podman
- Create a Minimal AOSP Build Container Image
- Create
Dockerfile
(e.g. in~/aosp-builder
):
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV USE_CCACHE=1
ENV CCACHE_DIR=/ccache
ENV CCACHE_EXEC=/usr/local/bin/ccache
RUN apt-get update && apt-get install -y --no-install-recommends \
git-core \
gnupg \
flex \
bison \
build-essential \
zip \
curl \
zlib1g-dev \
libc6-dev-i386 \
x11proto-core-dev \
libx11-dev \
lib32z1-dev \
libgl1-mesa-dev \
libxml2-utils \
xsltproc \
unzip \
fontconfig \
rsync \
openssl \
&& apt-get clean
COPY ccache /usr/local/bin/ccache
WORKDIR /workspace
- Build the container image:
cd ~/aosp-builder
podman build -t aosp-builder -f .
- Prepare Your AOSP Source (On Host)
Assuming your source is already synced in ~/aosp-src
:
cd ~/aosp-src
If not yet synced, fetch Android 15 AOSP (android-15.0.0_r30
) with:
repo init -u https://android.googlesource.com/platform/manifest -b android-15.0.0_r30
repo sync -c -j$(nproc)
- Launch the AOSP Build Container
Run Podman from the AOSP source directory:
cd ~/aosp-src
podman run -it --rm -v "$PWD":/workspace -v /home/administrator/.cache/ccache:/ccache aosp-builder bash
This mounts your local AOSP source into /workspace
inside the container.
- Build Android 15 AOSP (Inside the Container)
Inside the container shell:
source build/envsetup.sh
lunch aosp_arm64-trunk_staging-userdebug
m
- Build Completed
You should eventually see output like this:
[100% 169029/169029] touch out/soong/ndk_abi_diff.timestamp (priority: 0)
#### build completed successfully (04:39:53 (hh:mm:ss)) ####
- Verifying File Ownership on the Host
After exiting the container, you can confirm that all generated files — including the out
directory — are owned by your current host user:
ls -ld out
Example:
drwxr-xr-x 14 administrator administrator 4096 May 7 04:10 out