Configration
Using Windows 10, Docker Toolbox (not native Docker, to be able to use VMs).
Background
There is a Python (2.7) script that is supposed to run a Docker container. The code looks like this:
self.docker.containers.run('container_name',
command='bash -c "%s"' % command,
volumes={PROJECT_PATH: {'bind': '/shared', 'mode': 'rw'}},
working_dir='/shared',
remove=True,
**kwargs)
Problem
Trying to run the script:
* Building the DummyProbe docker image
* Running the DummyProbe container
500 Server Error: Internal Server Error ("invalid volume specification: 'C:\Users\Foo\..:/shared:rw'")
Thoughts
After searching the web the invalid volume specification
is seems to be caused by the way Windows and Linux handle directory structure. Linux uses slashes /
while Windows - back-slashed \
. Similar questions:
- Docker Toolbox Windows - Invalid volume specification
- Invalid volume specification trying to run portainer container
However in my case the COMPOSE_CONVERT_WINDOWS_PATHS
is set (to true
, tried setting to 1
as well):
PowerShell
Docker Toolbox
$ docker-machine env
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://111.111.11.111:1111"
export DOCKER_CERT_PATH="C:\Users\Foo\.docker\machine\machines\default"
export DOCKER_MACHINE_NAME="default"
export COMPOSE_CONVERT_WINDOWS_PATHS="true"
# Run this command to configure your shell:
# eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env)
None of the suggestions in other questions work.
Update
Tried to use to replace \
with /
and use it in script:
500 Server Error: Internal Server Error ("invalid volume specification: 'C:/Users/***/..:/shared:rw'")
So it seems like it is not an issue