Cannot mount binds with windows source
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 13d 8h
- Merged PRs (30d)
- 2
Description
I can't seem to mount paths originating from a Windows directory using the docker-py.
Mounting paths using docker-compose.yml
docker_client = docker.from_env()
docker_client.containers.run(
image='ubuntu',
command='sleep infinity',
remove=True,
detach=True,
mounts=mounts
)
I always seem to get an error:
mounts = [
Mount(target='/app/data', source=f'/c/', type='volume')
]
400 Client Error: Bad Request ("invalid mount config for type "bind": bind source path does not exist: /c/")
or
mounts = [
Mount(target='/app/data', source=f'C:/', type='volume')
]
400 Client Error: Bad Request ("invalid mount config for type "bind": invalid mount path: 'C:/' mount path must be absolute")
or
mounts = [
Mount(target='/app/data', source=f'C:\', type='volume')
]
400 Client Error: Bad Request ("invalid mount config for type "bind": invalid mount path: 'C:/' mount path must be absolute")
same for //c/
using a docker-compose.yml file, everything works no problemo.
I'd not be surprised if there is a mistake somewhere, but I can't seem to figure it out.
Any help is much appreciated!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Mount objects passed to docker_client.containers.run and compare their Windows source-path handling with the working docker-compose.yml configuration. Reproduce the three source forms against the Docker Engine API, then confirm the client accepts a valid Windows bind source without producing the reported mount errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- api, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100