I just recently upgraded to the latest docker toolbox and compose versions, and now my volume bindings are no longer working. I receive an "invalid bind mount spec" error when trying to build my container. Here is my compose file:
version: '2'
services:
fatbot:
build:
context: ./
dockerfile: ./Dockerfile
container_name: fatbot
ports:
- "80:80"
volumes:
- C:\Users\shamil8124\Desktop\backend:/var/www/html
command: /usr/sbin/apache2ctl -D FOREGROUND
And the error:
ERROR: for fatbot Cannot create container for service fatbot: Invalid bind mount spec "C:\\Users\\shamil8124\\Desktop\\backend:/var/www/html:rw": Invalid volume specification: 'C:\Users\shamil8124\Desktop\backend:/var/www/html:rw'
Apologies if this isn't the right place to ask for help with this. I've been lost for the past few days, and the docker forums along with Stackoverflow have not helped.
I'm getting the same error as well but with a different docker-compose.yml
file.
My file is as follows:
version: '2'
services:
app:
build:
context: ./
dockerfile: ./Dockerfile
volumes:
- ./:/var/www
The output of docker-compose up -d
is:
ERROR: for app Cannot create container for service app: Invalid bind mount spec "C:\\app:/var/www:rw": Invalid volume specification: 'C:\app:/var/www:rw'
I've understood that there is no such issue on the native Docker for Windows app which uses Hyper-V instead of VirtualBox. However, I'm not in the mood to upgrade my Windows 10 Home to Windows 10 Pro.
I hope there is a solution to this.
@mirorauhala I managed to have it working by downgrading my Docker Toolbox setup. I'm currently running version 1.12.0. If you download and run it, it will downgrade your "Compose," and it should get things working again.
Here's the link: https://github.com/docker/toolbox/releases/tag/v1.12.0
Will try! Thanks for the advice @shamil8124
This is with 1.12.5 Toolbox and Compose?
Can you please try the 1.13.0-rc4 https://github.com/docker/toolbox/releases/tag/v1.13.0-rc4 ?
There is an environment variable, COMPOSE_CONVERT_WINDOWS_PATHS
, which Machine 0.9.0 will set automatically, but 0.8.2 will not.
I bundled the latest stable version of Compose (1.9.0) in the 1.12.5 Toolbox, maybe this version breaks backwards compatibility.
Yeah it was with 1.12.5. I'll upgrade soon and let you know. Thank you. :)
@nathanleclaire will do. The older version which @shamil8124 suggested to install failed during the VM setup. Hopefully the rc4 works.
FWIW, If you keep hitting VM setup woes, you might want to try removing VMs and uninstalling VirtualBox, and re-installing the ToolBox (which will install VBox again). Make sure your system has latest Windows updates, too.
@nathanleclaire yup. Just removed everything. My win10 has automatic updates on. Downloaded the latest virtualbox from their website. (did a reboot in between just to be super cautious). Now installing rc4... wish me luck
Good luck have fun 馃槃 馃崁
Sadly, it still fails with the same error Cannot create container for service app: invalid bind mount spec
.
YEY! Got it working in the Docker CLI powershell.
Just needed to set the environment variable before running docker-compose
.
Run this in powershell.
$env:COMPOSE_CONVERT_WINDOWS_PATHS=0
If you set the value to 1 it still works, just like mentioned in #4240.
Hm, if 0.9.0-rc2 doesn't set COMPOSE_CONVERT_WINDOWS_PATHS
for the other shells, that's a bug. I'll have to look into that.
0.9.0-rc2 should set that value in powershell just fine using --shell powershell
:
$ docker-machine env --shell powershell
$Env:DOCKER_TLS_VERIFY = "1"
$Env:DOCKER_HOST = "tcp://192.168.99.100:2376"
$Env:DOCKER_CERT_PATH = "C:\Users\nathanleclaire\.docker\machine\machines\default"
$Env:DOCKER_MACHINE_NAME = "default"
$Env:DOCKER_API_VERSION = "1.25"
$Env:COMPOSE_CONVERT_WINDOWS_PATHS = "true"
# Run this command to configure your shell:
# & "C:\Program Files\Docker Toolbox\docker-machine.exe" env --shell powershell | Invoke-Expression
I'd recommend this issue be closed @shin- @dnephin ... Seems likely that everything should be OK in the next release
Most helpful comment
YEY! Got it working in the Docker CLI powershell.
Just needed to set the environment variable before running
docker-compose
.Run this in powershell.
If you set the value to 1 it still works, just like mentioned in #4240.