New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Path is not mounted correctly when running Docker hooks from Docker #1387
Comments
the docker* hook type assume you're on the host -- changing that breaks some of our assumptions but it might be possible to implement your suggestion the call into |
@okainov would you be interested in working on this? |
@asottile I'd really like to and I have also the update for not using |
Is there any appetite for mounting in a similar way to jenkins, where the docker container essentially becomes transparent since it would be mounted like so:
|
that would be a breaking change from the current set of guarantees |
Currently pre-commit mounts the current directory to /src and uses current directory name as mount base. However this does not work when pre-commit is run inside the container on some mounted path already, because mount points are relative to the host, not to the container. See https://gist.github.com/dpfoose/f96d4e4b76c2e01265619d545b77987a Fixes pre-commit#1387
Currently pre-commit mounts the current directory to /src and uses current directory name as mount base. However this does not work when pre-commit is run inside the container on some mounted path already, because mount points are relative to the host, not to the container. See https://gist.github.com/dpfoose/f96d4e4b76c2e01265619d545b77987a Fixes pre-commit#1387
Currently pre-commit mounts the current directory to /src and uses current directory name as mount base. However this does not work when pre-commit is run inside the container on some mounted path already, because mount points are relative to the host, not to the container. See https://gist.github.com/dpfoose/f96d4e4b76c2e01265619d545b77987a Fixes pre-commit#1387
Currently pre-commit mounts the current directory to /src and uses current directory name as mount base. However this does not work when pre-commit is run inside the container on some mounted path already, because mount points are relative to the host, not to the container. See https://gist.github.com/dpfoose/f96d4e4b76c2e01265619d545b77987a Fixes pre-commit#1387
Currently pre-commit mounts the current directory to /src and uses current directory name as mount base. However this does not work when pre-commit is run inside the container on some mounted path already, because mount points are relative to the host, not to the container. See https://gist.github.com/dpfoose/f96d4e4b76c2e01265619d545b77987a Fixes pre-commit#1387
Currently pre-commit mounts the current directory to /src and uses current directory name as mount base. However this does not work when pre-commit is run inside the container on some mounted path already, because mount points are relative to the host, not to the container. Fixes pre-commit#1387
Currently pre-commit mounts the current directory to /src and uses current directory name as mount base. However this does not work when pre-commit is run inside the container on some mounted path already, because mount points are relative to the host, not to the container. Fixes pre-commit#1387
Currently pre-commit mounts the current directory to /src and uses current directory name as mount base. However this does not work when pre-commit is run inside the container on some mounted path already, because mount points are relative to the host, not to the container. Fixes pre-commit#1387
Currently pre-commit mounts the current directory to /src and uses current directory name as mount base. However this does not work when pre-commit is run inside the container on some mounted path already, because mount points are relative to the host, not to the container. Fixes pre-commit#1387
Currently pre-commit mounts the current directory to /src and uses current directory name as mount base. However this does not work when pre-commit is run inside the container on some mounted path already, because mount points are relative to the host, not to the container. Fixes pre-commit#1387
Currently pre-commit mounts the current directory to /src and uses current directory name as mount base. However this does not work when pre-commit is run inside the container on some mounted path already, because mount points are relative to the host, not to the container. Fixes pre-commit#1387
Currently pre-commit mounts the current directory to /src and uses current directory name as mount base. However this does not work when pre-commit is run inside the container on some mounted path already, because mount points are relative to the host, not to the container. Fixes pre-commit#1387
Situation:
pre-commit
inside Docker.docker_image
Problem
This line mostly
pre-commit/pre_commit/languages/docker.py
Line 94 in 528c7af
Currently
pre-commit
mounts the current directory to/src
and uses current directory name as mount base.However this does not work when
pre-commit
is run inside the container on some mounted path already, because mount points are relative to the host, not to the container.Example:
Currently pre-commit will try to mount it as
-v /project:/src,rw,Z
. Expected - to mount it as-v /opt/my_code:/src
Possible solution:
When I replaced
os.getcwd()
from the code above totranslate_path(os.getcwd())
wheretranslate_path
is taken from https://gist.github.com/dpfoose/f96d4e4b76c2e01265619d545b77987a, it worked perfectly. It does add extradocker
pip-dependency though.See also: https://forums.docker.com/t/mounting-a-volume-not-working-with-running-docker-in-docker/25775/2
The text was updated successfully, but these errors were encountered: