mirror of https://github.com/coder/coder.git
60 lines
2.2 KiB
Docker
60 lines
2.2 KiB
Docker
FROM ubuntu:22.04
|
|
|
|
LABEL org.opencontainers.image.description="Base Ubuntu image for rootless podman in Coder. See https://coder.com/docs/v2/latest/templates/docker-in-docker#rootless-podman"
|
|
|
|
USER root
|
|
|
|
# Install dependencies
|
|
RUN apt-get update && apt-get install -y sudo gnupg2 curl vim fuse-overlayfs libvshadow-utils openssh-client
|
|
|
|
# Install podman
|
|
RUN mkdir -p /etc/apt/keyrings
|
|
RUN curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_22.04/Release.key \
|
|
| gpg --dearmor \
|
|
| tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null
|
|
RUN echo \
|
|
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg]\
|
|
https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_22.04/ /" \
|
|
| tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null
|
|
RUN apt-get update && apt-get -y install podman
|
|
|
|
RUN setcap cap_setuid+ep /usr/bin/newuidmap
|
|
RUN setcap cap_setgid+ep /usr/bin/newgidmap
|
|
RUN chmod 0755 /usr/bin/newuidmap
|
|
RUN chmod 0755 /usr/bin/newgidmap
|
|
|
|
RUN useradd podman
|
|
RUN echo "podman:100000:65536" > /etc/subuid
|
|
RUN echo "podman:100000:65536" > /etc/subgid
|
|
RUN echo "podman ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers
|
|
|
|
ADD containers.conf /etc/containers/containers.conf
|
|
ADD storage.conf /etc/containers/storage.conf
|
|
RUN chmod 644 /etc/containers/containers.conf && \
|
|
chmod 644 /etc/containers/storage.conf
|
|
|
|
RUN mkdir -p /home/podman/.local/share/containers && \
|
|
chown podman:podman -R /home/podman && \
|
|
chmod 644 /etc/containers/containers.conf
|
|
|
|
RUN mkdir -p /var/lib/shared/overlay-images \
|
|
/var/lib/shared/overlay-layers \
|
|
/var/lib/shared/vfs-images \
|
|
/var/lib/shared/vfs-layers && \
|
|
touch /var/lib/shared/overlay-images/images.lock && \
|
|
touch /var/lib/shared/overlay-layers/layers.lock && \
|
|
touch /var/lib/shared/vfs-images/images.lock && \
|
|
touch /var/lib/shared/vfs-layers/layers.lock
|
|
|
|
ENV _CONTAINERS_USERNS_CONFIGURED=""
|
|
|
|
# Alias "docker" to "podman"
|
|
RUN ln -s /usr/bin/podman /usr/bin/docker
|
|
|
|
RUN chsh -s /bin/bash podman
|
|
|
|
|
|
USER podman
|
|
|
|
ENV SHELL=/bin/bash
|