Skip to content

Commit 61aa43d

Browse files
authored
Merge pull request #642 from jimmidyson/docker-selinux
Add selinux labelling option to docker_image hook type
2 parents 3b10ef4 + 2e5b4fc commit 61aa43d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

pre_commit/languages/docker.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ def docker_cmd():
8282
'docker', 'run',
8383
'--rm',
8484
'-u', '{}:{}'.format(os.getuid(), os.getgid()),
85-
'-v', '{}:/src:rw'.format(os.getcwd()),
85+
# https://docs.docker.com/engine/reference/commandline/run/#mount-volumes-from-container-volumes-from
86+
# The `Z` option tells Docker to label the content with a private
87+
# unshared label. Only the current container can use a private volume.
88+
'-v', '{}:/src:rw,Z'.format(os.getcwd()),
8689
'--workdir', '/src',
8790
)
8891

0 commit comments

Comments
 (0)