Skip to content

Commit

Permalink
Fix nested containers
Browse files Browse the repository at this point in the history
fixes: #540
  • Loading branch information
mikedep333 committed Aug 29, 2023
1 parent 2471d88 commit e8ef897
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES/540.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix nested containers failing to start
11 changes: 9 additions & 2 deletions images/Containerfile.core.base
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ RUN dnf -y install python38 python38-cryptography python38-devel && \
dnf -y install sudo && \
dnf -y install zstd && \
dnf -y install which && \
getcap /usr/bin/newuidmap | grep cap_setuid || dnf -y reinstall -y shadow-utils && \
dnf clean all

# Needed to prevent the wrong version of cryptography from being installed,
Expand All @@ -79,11 +80,17 @@ RUN pip3 install --upgrade pip setuptools wheel && \
requests\[use_chardet_on_py3] && \
rm -rf /root/.cache/pip

RUN sed 's|^#mount_program|mount_program|g' -i /etc/containers/storage.conf

RUN groupadd -g 700 --system pulp
RUN useradd -d /var/lib/pulp --system -u 700 -g pulp pulp
RUN usermod --add-subuids 100000-165535 --add-subgids 100000-165535 pulp

# Rootless podman inside rootless podman/docker
# https://www.redhat.com/sysadmin/podman-inside-container
RUN sed 's|^#mount_program|mount_program|g' -i /etc/containers/storage.conf
RUN usermod --add-subuids 10000-65535 --add-subgids 10000-65535 pulp
VOLUME /var/lib/containers
RUN mkdir -p /var/lib/pulp/.local/share/containers && chown -R pulp:pulp /var/lib/pulp/.local
VOLUME /var/lib/pulp/.local/share/containers

RUN mkdir -p /database \
/etc/nginx/pulp \
Expand Down
4 changes: 3 additions & 1 deletion images/s6_assets/pulp_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ echo "Setup deb release signing service"
podman exec -u pulp -i pulp bash -c "cat > /var/lib/pulp/scripts/sign_deb_release.sh" < "${PWD}/tests/assets/sign_deb_release.sh"
podman exec -u pulp pulp chmod a+rx /var/lib/pulp/scripts/sign_deb_release.sh
podman exec -u pulp pulp bash -c "pulpcore-manager add-signing-service --class deb:AptReleaseSigningService sign_deb_release /var/lib/pulp/scripts/sign_deb_release.sh 'Pulp QE'"
podman exec -u pulp pulp getcap /usr/bin/newuidmap
podman exec -u pulp pulp podman run quay.io/redhattraining/hello-world-nginx

echo "Run all CLI tests"
make test
make test
1 change: 1 addition & 0 deletions images/s6_assets/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ start_container_and_wait() {
--volume "$(pwd)/pgsql":/var/lib/pgsql:Z \
--volume "$(pwd)/containers":/var/lib/containers:Z \
--device /dev/fuse \
--device /dev/net/tun \
-e PULP_DEFAULT_ADMIN_PASSWORD=password \
-e PULP_HTTPS=${pulp_https} \
"$1"
Expand Down

0 comments on commit e8ef897

Please sign in to comment.