Open orbelico opened 2 years ago
This seems related to https://github.com/docker/docker-py/pull/3073. Try working that around by supplying a volumes dict instead of list. It will bypass this step and not call the problematic function (this line).
Thx @pevidex, will try that as soon as I find the time.
Short description and how to reproduce
If I mount a volume or host path to
/var/lib/docker
inside a container, using docker-py:>>> client.containers.run('alpine', volumes=['my_volume:/var/lib/docker'])
, a very strange behavior occurs:/var/lib/docker
(so far, so good)var/lib/docke
[sic!] - without the trailing "r"!While this does not actually break any functionality, it leads to a lot of useless volumes accumulating on my system. And these are not easy to filter from other, also automatically created volumes, that I actually still need, so cleaning up is very tedious.
This is apparently a problem of docker-py, not of docker itself: when doing the same using docker CLI everything works as expected:
$ docker run -v my_volume:/var/lib/docker alpine
The specific use case where I would like to mount a volume to that path is the
docker:dind
image from the official docker library. It requires/var/lib/docker
to be a volume in its Dockerfile. I want to provide my own volume (or host path) for this, so I can manage and re-use the docker cache.Logs / Inspects
Inspect container (shortened to relevant part) clearly shows the two mount paths:
Inspect the invalidly created volume:
Shell into affected container clearly shows that both dirs exist, but only one is in use:
Version information
Host OS:
Please let me know if I can provide any more information.