summaryrefslogtreecommitdiffstats
path: root/pre_commit/languages/docker.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2020-04-28 05:31:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2020-04-28 05:31:37 +0000
commitd48befde4a798ba4da4f30010e9d0105b1f23d8b (patch)
treeec2b561add30ebe20d451f863de6b5319d8fc099 /pre_commit/languages/docker.py
parentAdding upstream version 2.2.0. (diff)
downloadpre-commit-d48befde4a798ba4da4f30010e9d0105b1f23d8b.tar.xz
pre-commit-d48befde4a798ba4da4f30010e9d0105b1f23d8b.zip
Adding upstream version 2.3.0.upstream/2.3.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit/languages/docker.py')
-rw-r--r--pre_commit/languages/docker.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pre_commit/languages/docker.py b/pre_commit/languages/docker.py
index f449584..4091492 100644
--- a/pre_commit/languages/docker.py
+++ b/pre_commit/languages/docker.py
@@ -76,18 +76,18 @@ def install_environment(
os.mkdir(directory)
-def get_docker_user() -> str: # pragma: win32 no cover
+def get_docker_user() -> Tuple[str, ...]: # pragma: win32 no cover
try:
- return f'{os.getuid()}:{os.getgid()}'
+ return ('-u', f'{os.getuid()}:{os.getgid()}')
except AttributeError:
- return '1000:1000'
+ return ()
def docker_cmd() -> Tuple[str, ...]: # pragma: win32 no cover
return (
'docker', 'run',
'--rm',
- '-u', get_docker_user(),
+ *get_docker_user(),
# https://docs.docker.com/engine/reference/commandline/run/#mount-volumes-from-container-volumes-from
# The `Z` option tells Docker to label the content with a private
# unshared label. Only the current container can use a private volume.