feat: switch to kernel overlay >5.13

This commit is contained in:
Stefan Reimer 2022-07-11 11:47:24 +00:00
parent 9d26711bc4
commit 8a0c8f66d5
4 changed files with 10 additions and 35 deletions

View File

@ -12,7 +12,6 @@ RUN apk upgrade -U --available --no-cache && apk add --no-cache \
make \ make \
yq \ yq \
strace \ strace \
fuse-overlayfs \
podman \ podman \
buildah \ buildah \
aws-cli aws-cli
@ -22,36 +21,25 @@ RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/reposit
trivy trivy
# Trivy html template # Trivy html template
ADD --chown=jenkins:jenkins html.tpl /home/jenkins ADD --chown=$USER:$USER html.tpl /home/$USER
# Rootless podman # Rootless podman
RUN mkdir -p /home/$USER/.local/share/containers && \ RUN mkdir -p /home/$USER/.config/containers
chown $USER:$USER -R /home/$USER
ADD conf/containers.conf conf/registries.conf conf/storage.conf /etc/containers/ ADD --chown=$USER:$USER conf/containers.conf conf/registries.conf conf/storage.conf /home/$USER/.config/containers
ADD --chown=$USER:$USER conf/podman-containers.conf /home/$USER/.config/containers/containers.conf
RUN mkdir -p /var/lib/shared/overlay-images /var/lib/shared/overlay-layers \ RUN echo -e "$USER:1:999\n$USER:1001:64535" > /etc/subuid && \
/var/lib/shared/vfs-images /var/lib/shared/vfs-layers && \
touch /var/lib/shared/overlay-images/images.lock /var/lib/shared/overlay-layers/layers.lock \
/var/lib/shared/vfs-images/images.lock /var/lib/shared/vfs-layers/layers.lock && \
mkdir /tmp/podman-run-1000 && chown $USER:$USER /tmp/podman-run-1000 && chmod 700 /tmp/podman-run-1000 && \
echo -e "$USER:1:999\n$USER:1001:64535" > /etc/subuid && \
echo -e "$USER:1:999\n$USER:1001:64535" > /etc/subgid && \ echo -e "$USER:1:999\n$USER:1001:64535" > /etc/subgid && \
mkdir /workspace && \ cd /usr/bin && ln -s podman docker && \
cd /usr/bin && ln -s podman docker chown $USER:$USER -R /home/$USER
# Patch jenkins-agent to launch podman service # Patch jenkins-agent to launch podman service
RUN sed -i -e 's/exec \$JAVA_BIN/podman system service -t0\&\n exec \$JAVA_BIN/' /usr/local/bin/jenkins-agent RUN sed -i -e 's/exec \$JAVA_BIN/podman system service -t0\&\n exec \$JAVA_BIN/' /usr/local/bin/jenkins-agent
ENV XDG_RUNTIME_DIR=/tmp/podman-run-1000 ENV XDG_RUNTIME_DIR=/home/$USER/agent
ENV _CONTAINERS_USERNS_CONFIGURED="" ENV _CONTAINERS_USERNS_CONFIGURED=""
ENV BUILDAH_ISOLATION=chroot
ENV TRIVY_TEMPLATE="@/home/jenkins/html.tpl" ENV TRIVY_TEMPLATE="@/home/jenkins/html.tpl"
USER $USER USER $USER
# Allow container layers to be stored in PVCs
VOLUME /home/$USER/.local/share/containers
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/jenkins-agent"] ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/jenkins-agent"]

View File

@ -1,4 +1,5 @@
[containers] [containers]
volumes = [ "/proc:/proc" ]
netns="host" netns="host"
userns="host" userns="host"
ipcns="host" ipcns="host"

View File

@ -1,4 +0,0 @@
[containers]
volumes = [
"/proc:/proc",
]

View File

@ -1,14 +1,4 @@
[storage] [storage]
driver = "overlay" driver = "overlay"
runroot = "/run/containers/storage" runroot = "/home/jenkins/agent/containers/run"
graphroot = "/var/lib/containers/storage" graphroot = "/home/jenkins/agent/containers/storage"
[storage.options]
additionalimagestores = [
"/var/lib/shared",
]
[storage.options.overlay]
mount_program = "/usr/bin/fuse-overlayfs"
mountopt = "nodev,fsync=0"
[storage.options.thinpool]