ghaction-setup-docker icon indicating copy to clipboard operation
ghaction-setup-docker copied to clipboard

rootless still requires sudo

Open begs opened this issue 11 months ago • 4 comments

Contributing guidelines

I've found a bug, and:

  • [x] The documentation does not mention anything about my problem
  • [x] There are no open or closed issues that are related to my problem

Description

Hi, I'm trying to run this action in a runner that uses a distroless image without sudo available.

Expected behaviour

setup-docker-action installs Docker without needing sudo.

Actual behaviour

I'm trying to run this action using rootless:

with:
  rootless: true

but I'm getting an error when it tries to start the Docker daemon.

Start Docker daemon
Error: Unable to locate executable file: sudo. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.

Repository URL

No response

Workflow run URL

No response

YAML workflow

- name: Setup Docker
  uses: docker/setup-docker-action@v4
  with:
    rootless: true

Workflow logs

No response

Docker daemon logs


Additional info

No response

begs avatar Feb 21 '25 12:02 begs

Found the same error while running the action inside a container

jobs:
  test-e2e:
    name: 🚥 E2E test
    runs-on: ubuntu-latest
    container:
      image: mcr.microsoft.com/playwright:v1.51.1-noble
      options: --user 1001
    steps:
      - name: 🐳 Set up Docker
        uses: docker/setup-docker-action@v4
        with:
          rootless: true

wladpaiva avatar Apr 03 '25 15:04 wladpaiva

I have the same issue, i've noticed that the logs provided by the actions are slightly different when the rootless: true parameter is provided, so the problem is not on this end but in this actions-toolkit line of code. @crazy-max

Log with rootless: true:

2025-04-17T15:30:38.0333455Z ##[group]Start Docker daemon
2025-04-17T15:30:38.0369595Z ##[endgroup]
2025-04-17T15:30:38.0398613Z ##[error]Unable to locate executable file: sudo. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
2025-04-17T15:30:38.0618205Z Post job cleanup.

Log with rootless: false:

> 2025-04-17T15:09:52.2825064Z ##[group]Start Docker daemon
2025-04-17T15:09:52.2837524Z [command] /__t/docker-archive-stable/28.0.4/x64/dockerd --host="unix:///github/home/setup-docker-action-10b1b8c4/docker.sock" --config-file="/github/home/setup-docker-action-10b1b8c4/daemon.json" --exec-root="/github/home/setup-docker-action-10b1b8c4/execroot" --data-root="/github/home/setup-docker-action-10b1b8c4/data" --pidfile="/github/home/setup-docker-action-10b1b8c4/docker.pid"
2025-04-17T15:09:52.2873385Z /bin/sh: 1: sudo: not found
2025-04-17T15:09:55.3050851Z ##[endgroup]
2025-04-17T15:09:55.3080792Z ##[error]The process '/__t/docker-archive-stable/28.0.4/x64/docker' failed with exit code 1
2025-04-17T15:09:55.3301118Z Post job cleanup.

GabrieleMessina avatar Apr 17 '25 15:04 GabrieleMessina

I have the same issue, with rootless: true it does not have an option to accept user as input param:

2025-06-11T15:08:15.3074031Z ##[group]Run docker/setup-docker-action@b60f85385d03ac8acfca6d9996982511d8620a19
2025-06-11T15:08:15.3074819Z with:
2025-06-11T15:08:15.3075003Z   rootless: true
2025-06-11T15:08:15.3075380Z   daemon-config: {
  "debug": true,
  "features": {
    "containerd-snapshotter": true
  }
}

2025-06-11T15:08:15.3075751Z   version: latest
2025-06-11T15:08:15.3075939Z   set-host: false
2025-06-11T15:08:15.3076292Z ##[endgroup]
2025-06-11T15:08:15.6124218Z ##[group]Download docker
2025-06-11T15:08:15.6124931Z Downloading Docker latest from stable at download.docker.com
2025-06-11T15:08:15.8002738Z Downloading https://download.docker.com/linux/static/stable/x86_64/docker-28.2.2.tgz
2025-06-11T15:08:16.4646616Z [command]/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /tmp/_temp/562f9c50-0c0f-44db-ace1-f8c17e6673b1 -f /tmp/_temp/088802bb-c489-454c-bef0-5fe453b62a11
2025-06-11T15:08:17.8837793Z Downloading Docker rootless extras latest from stable at download.docker.com
2025-06-11T15:08:17.9171413Z Downloading https://download.docker.com/linux/static/stable/x86_64/docker-rootless-extras-28.2.2.tgz
2025-06-11T15:08:19.0816210Z [command]/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /tmp/_temp/0a90f6a6-a5b0-408d-a9d1-f1185893bbd1 -f /tmp/_temp/5784ffe6-6d0a-44b7-afc0-d413fc6ac07d
2025-06-11T15:08:19.4183114Z Fixing perms
2025-06-11T15:08:20.8892929Z Added Docker to PATH
2025-06-11T15:08:20.8894673Z ##[endgroup]
2025-06-11T15:08:20.8911687Z ##[group]Writing Docker daemon config
2025-06-11T15:08:20.8912611Z {
2025-06-11T15:08:20.8913067Z   "debug": true,
2025-06-11T15:08:20.8913790Z   "features": {
2025-06-11T15:08:20.8914367Z     "containerd-snapshotter": true
2025-06-11T15:08:20.8915043Z   }
2025-06-11T15:08:20.8915460Z }
2025-06-11T15:08:20.8916452Z ##[endgroup]
2025-06-11T15:08:20.8918839Z ##[group]Start Docker daemon
2025-06-11T15:08:20.8936507Z [command] /tmp/_tool/docker-archive-stable/28.2.2/x64/dockerd-rootless.sh --host="unix:///home/runner/setup-docker-action-380d21bc/docker.sock" --config-file="/home/runner/setup-docker-action-380d21bc/daemon.json" --exec-root="/home/runner/setup-docker-action-380d21bc/execroot" --data-root="/home/runner/setup-docker-action-380d21bc/data" --pidfile="/home/runner/setup-docker-action-380d21bc/docker.pid"
2025-06-11T15:08:20.9008240Z sudo: unknown user: #1001
2025-06-11T15:08:23.9181334Z ##[endgroup]
2025-06-11T15:08:23.9203025Z ##[error]The process '/tmp/_tool/docker-archive-stable/28.2.2/x64/docker' failed with exit code 1

itsankit-google avatar Jun 11 '25 15:06 itsankit-google

Related issue: sudo is still required even if you're running the build container with --privileged option.

v1993 avatar Jul 24 '25 12:07 v1993