A framework for managing and maintaining multi-language pre-commit hooks.
Find a file
Matthew Hughes 466f6c4a39 Fix permission errors for mounts in rootless docker
By running containers in a rootless docker context as root. This is
because user and group IDs are remapped in the user namespaces uses by
rootless docker, and it's unlikely that the current user ID will map to
the same ID under this remap (see docs[1] for some more details).
Specifically, it means ownership of mounted volumes will not be for the
current user and trying to write can result in permission errors.

This change borrows heavily from an existing PR[2].

The output format of `docker system info` I don't think is
documented/guaranteed anywhere, but it should corresponding to the
format of a `/info` API request to Docker[3]

The added test _hopes_ to avoid regressions in this behaviour, but since
tests aren't run in a rootless docker context on the PR checks (and I
couldn't find an easy way to make it the case) there's still a risk of
regressions sneaking in.

Link: https://docs.docker.com/engine/security/rootless/ [1]
Link: https://github.com/pre-commit/pre-commit/pull/1484/ [2]
Link: https://docs.docker.com/reference/api/engine/version/v1.48/#tag/System/operation/SystemAuth [3]
Co-authored-by: Kurt von Laven <Kurt-von-Laven@users.noreply.github.com>
Co-authored-by: Fabrice Flore-Thébault <ffloreth@redhat.com>
2025-05-23 17:01:10 -04:00
.github upgrade asottile/workflows 2025-01-30 14:58:50 -05:00
pre_commit Fix permission errors for mounts in rootless docker 2025-05-23 17:01:10 -04:00
testing remove unused type ignore 2024-10-21 20:35:56 -04:00
tests Fix permission errors for mounts in rootless docker 2025-05-23 17:01:10 -04:00
.gitignore remove unneeded gitignore lines 2022-03-13 19:55:30 -04:00
.pre-commit-config.yaml [pre-commit.ci] pre-commit autoupdate 2025-03-31 19:43:51 +00:00
.pre-commit-hooks.yaml deprecate pre-commit-validate-{config,manifest} 2022-04-24 19:08:47 -04:00
CHANGELOG.md v4.2.0 2025-03-18 17:34:49 -04:00
CONTRIBUTING.md fix typo in CONTRIBUTING.md 2023-08-14 11:00:17 +01:00
LICENSE MIT 2014-06-05 08:57:40 -07:00
README.md azure pipelines -> github actions 2022-12-29 22:18:31 -05:00
requirements-dev.txt always use #!/bin/sh on windows 2022-01-05 13:22:49 -05:00
setup.cfg [pre-commit.ci] auto fixes from pre-commit.com hooks 2025-03-31 19:44:12 +00:00
setup.py drop python 3.6 support 2022-01-18 18:44:20 -05:00
tox.ini show 20 slowest durations in CI 2023-03-09 11:00:31 -05:00

build status pre-commit.ci status

pre-commit

A framework for managing and maintaining multi-language pre-commit hooks.

For more information see: https://pre-commit.com/