10

I wanted to deploy my application on a windows system. I recently (yesterday) installed DockerToolbox-1.12.4 on my windows 10. This gives my a new terminal. When I tried to deploy my projet with docker-compose up --build, I receive this massage:

  1. ERROR: for myservice Cannot create container for myService: create \var\run\docker.socker: "\\var\\run\\docker.sock" includes invalid characters for a local volume name, only "[...][...]" are allowed this service contains

and an other error is:

  1. ERROR: for service2 Cannont create container for service service2: Invalid bind mount spec "c:\\Users\\username\\Desktop\\project\\service2:/home/docker/code:rw" Encountered errors while bringing up projet. My project has 4 containers and there is not error message for the 2 others.

here is my docker-compose.yml file:

version: '2'
services:
  s1:
    build: ../images/s1
    ports:
     - "5000:5000"
    links: ["s2"]
  s2:
    build: ../images/s2
    ports:
     - "9000:9000"
  service2:
    build: ../images/service2
    ports:
     - "4000:4000"
    volumes:
      - ../images/service2:/home/docker/code
  myService:
    build: ../images/myService
    ports:
     - "7000:7000"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

What should I do to make this works ? Can you please help to solve this ?

my docker version is : docker version 1.12.4, build 1564f02 my docker-compose version is : docker-compose version 1.9.0, build 2585387

dmx
  • 1,862
  • 3
  • 26
  • 48

3 Answers3

20

This example works for me:

  test_dev:
    image: test/node:7.9
    ports:
      - "3000:3000"
    volumes:
      - //c/Users/user/Sources:/usr/src/app/
    command:
     node /usr/src/app/start.js
Pang
  • 9,564
  • 146
  • 81
  • 122
mudrii
  • 689
  • 6
  • 4
  • I am using WSL1 and I'm running docker-compose from it. I was thinking that I can simply use UNIX paths referencing but only your solution worked for me. Thanks a lot, however I think it's a temporary workaround for Windows. – rozacek Feb 17 '20 at 12:04
  • I can't edit above unfortuanately. Maybe will be useful for somebody: [long-syntax for volumes](https://devops.stackexchange.com/a/10830/19719) from [official docs](https://docs.docker.com/compose/compose-file/#long-syntax-3) – rozacek Feb 17 '20 at 13:59
7

I think you have to set COMPOSE_CONVERT_WINDOWS_PATHS=1 in your environment. See:

friism
  • 19,068
  • 5
  • 80
  • 116
0

I had some issues trying to run docker-compose build on windows 10. Error: 'Failed to execute script docker-compose'

After trying so many things and finally ran docker quick start terminal which ran Bash shell. I ran cmd command to switch to cmd and tryied the build command. That's it. Worked for me

Lasithds
  • 2,161
  • 25
  • 39