3

I'm using Windows 7 Enterprise

Docker Client version:
 Version:      1.12.2
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   bb80604
 Built:        Tue Oct 11 17:00:50 2016
 OS/Arch:      windows/amd64

Docker Server version:
 Version:      1.12.3
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   6b644ec
 Built:        Wed Oct 26 23:26:11 2016
 OS/Arch:      linux/amd64

docker-compose version:
docker-compose version 1.9.0, build 2585387
docker-py version: 1.10.6
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2h  3 May 2016

I couldn't figure out how to mount volumes in docker-compose.yml file when using a docker toolbox on windows.

Below is the docker-compose.yml file.

version: '2'
services:
    myapp:
        build:
           context: .
           args:
               ADMIN_PASS= welcome1
        ports:
         - "7001:8001"
        volumes:
         - "/C/myapp/gradleBuild/myappEar/libs:/myappEar"

when I run docker-compose up below is the error I'm getting

ERROR: for myapp Cannot create container for service myapp: create \C\myapp\gradleBuild\myappEar\libs: "\\C\\myapp\\gradleBuild\\myappEar\\libs" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed
←[31mERROR←[0m: Encountered errors while bringing up the project. 

when I change the volumes section to

volumes:
   - "/c/myapp/gradleBuild/myappEar/libs:/myappEar"

It throws the same error

And when I finally change the volumes section to

volumes:
  - "C:/myapp/gradleBuild/myappEar/libs:/myappEar" 

It throws the below error

ERROR: for myapp Cannot create container for service myapp: Invalid bind mount spec "C:\\myapp\\gradleBuild\\myappEar\\libs:/myappEar:rw": Invalid volume specification: 'C:/myapp/gradleBuild/myappEar/libs:/myappEar:rw'
←[31mERROR←[0m: Encountered errors while bringing up the project.

Can anyone please help me get through this?

Thanks in advance.

beginner
  • 183
  • 1
  • 5
  • 13

2 Answers2

3

Note that if you are using docker toolbox (meaning docker through a VirtualBox VM), only /c/users/mylogin is available by default.
You need to declare other mount locations if your path does not include c:\Users\myLogin.

You access more of the C drive only through HyperV VM on Windows 10 (which you don't have, since you are on Windows 7).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I added the `myapp` folder in the `/c/Users//myapp` and changed the `docker-compose` file and tried running the `docker-compose up` but, still having same error `ERROR: for myapp Cannot create container for service myapp: create \c\Users\mreddy\myapp\gradleBuild\myappEar\libs: "\\c\\Users\\mreddy\\myapp\\gradleBuild\\myappEar\\libs" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed ←[31mERROR←[0m: Encountered errors while bringing up the project.` – beginner Dec 01 '16 at 22:43
1

In your docker-compose image you have mounted the volume as such:

volumes: - "/C/myapp/gradleBuild/myappEar/libs:/myappEar"

On windows it is mentioned to mount docker volumes using the format below:

c:\<path>:/c:\<container path>

More information can be found here