Search code examples
dockermsys

docker stack deploy windows volume path prepended with working directory


I am using docker compose files with stack deploy. My docker client is 17.04. here is the offending compose file snippet:

version: '3.1'
services:
  identityservice:
    image: registry.mms.local/identityservice:1.94.20117
    networks:
     - microlise_net
    depends_on:
     - identityservicedb1
     - identityservicedb2
     - identityservicedb3
     - identityservicedbarbiter
    volumes:
     - C:\var\storage\logs:C:\storage\logs
    deploy:
      placement:
        constraints: [node.labels.platform == windows]
    .........

when I use git bash to deploy this, the service fails to replicate and inspecting the service I see this in the volume mapping

 "Mounts": [
                {
                    "Type": "bind",
                    "Source": "G:\\repos\\IdentityService\\Microlise.IdentityServer.Microservice/C:\\var\\storage\\logs",
                    "Target": "C:\\storage\\logs"
                }
            ]

As you can see the the source path is having my working directory prepended to it.

I have tried a variety of formats. Some do remove the prepended path but do not work, others the path remains.

//C:/var/

//c/var

\c:\var

\c:\var

/c:\var

//C:\var

/c\var

//C\var

I have also found an environment varialbe to prevent the paths being appended, but then I could not run the docker commands at all.

MSYS_NO_PATHCONV=1

I am also seing this if I deploy from TFS using the Docker run task.

What am I missing? what is the correct path format for windows docker hosts? the documentation is a little unhelpful.


Solution

  • At first, be sure, that you have shared the disk drive inside the docker settings.

    The right path in the Mounts-section should look so:

     /host_mnt/c/var