Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
lock

GitHub Action

Rootless Docker

0.1.6

Rootless Docker

lock

Rootless Docker

Run Docker in Rootless Mode to Prevent Permission Errors

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Rootless Docker

uses: ScribeMD/[email protected]

Learn more about this action in ScribeMD/rootless-docker

Choose a version

rootless-docker

GitHub Action: Try Me Rootless Docker Test Workflow Status Copy/Paste: 0%

Automated Updates: Dependabot Package Management: Poetry Git Hooks: pre-commit Commit Style: Conventional Commits Releases: Semantic Versioning Code Style: Prettier Code Style: EditorConfig Editor: Visual Studio Code

Run Docker in Rootless Mode to Prevent Permission Errors

GitHub-hosted (and many self-hosted) runners use rootful Docker, but the runner itself does not run as root. As described in actions/runner#434, files created by Docker containers are hence owned by root, resulting in permission errors when the runner attempts to clean up checked out repositories. This action efficiently prevents those permission errors by running Docker in rootless mode so that all files are owned by the runner user. This approach has many benefits as it is:

  • safer than elevating the runner to root
  • less brittle than changing the ownership/permissions of or deleting files
  • simpler than other ways of running rootless Docker
  • and fast (~15 seconds on GitHub-hosted runner ubuntu-20.04)

Docker's documentation discusses rootless mode in detail. If you are running a supported Linux distribution locally, you can follow the steps there to use rootless mode. If you aren't sure, you can ask Docker whether it is in rootless mode:

docker info --format "{{ .ClientInfo.Context }}"

Usage

  • Add the following step before your first use of Docker:

    - name: Use Docker in rootless mode.
      uses: ScribeMD/[email protected]

Supported Runners

  • Tested on ubuntu-20.04
  • Probably works on ubuntu-18.04
  • May work on future versions of Linux
  • Definitely doesn't work on Windows or macOS since Docker only offers rootless mode on Linux

Changelog

Please refer to CHANGELOG.md.