Skip to content

Commit

Permalink
rootful podman
Browse files Browse the repository at this point in the history
  • Loading branch information
marko-k0 committed Jun 21, 2024
1 parent 1393ba4 commit 2ab8d09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 7 additions & 1 deletion images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ENV ImageOS=ubuntu24

# 'gpg-agent' and 'software-properties-common' are needed for the 'add-apt-repository' command that follows
RUN apt update -y \
&& apt install -y --no-install-recommends sudo lsb-release gpg-agent software-properties-common podman podman-docker uidmap \
&& apt install -y --no-install-recommends sudo lsb-release gpg-agent software-properties-common podman \
&& rm -rf /var/lib/apt/lists/*

# Configure git-core/ppa based on guidance here: https://git-scm.com/download/linux
Expand All @@ -42,6 +42,12 @@ RUN adduser --disabled-password --gecos "" --uid 1001 runner \
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers

COPY <<EOF /usr/bin/docker
#!/usr/bin/env bash
sudo podman "$@"
EOF
RUN chmod +x /usr/bin/docker

WORKDIR /home/runner

COPY --chown=runner:runner --from=build /actions-runner .
Expand Down
3 changes: 1 addition & 2 deletions src/Runner.Worker/Container/DockerCommandManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ public async Task<string> DockerCreate(IExecutionContext context, ContainerInfo
// TODO: pull opts from env
dockerOptions.Add("--privileged");
dockerOptions.Add("--cgroupns host");
dockerOptions.Add("--uidmap 1001:0:1");
dockerOptions.Add("--uidmap 0:1:1001");
dockerOptions.Add("-u 1001:1001");
//dockerOptions.Add("--userns keep-id");
if (!string.IsNullOrEmpty(container.ContainerWorkDirectory))
{
Expand Down

0 comments on commit 2ab8d09

Please sign in to comment.