kuskmen
kuskmen

Reputation: 3775

Docker-compose top level volume unable to find path

I have a pretty simple docker-compose setup which is working on my colleague computer (*), but for some obscure reason it doesn't work on mine.

Here is my docker-compose.yml

version: '3.3'
services:

    ... there are other services that are starting successfully ...

    reporting:
      image: microsoft/dotnet:2.0-runtime
      hostname: reporting
      container_name: reporting
      volumes:
        - publish-output:/app
        command: dotnet /app/MocksGenerator.dll -s ${MSNAME_R} -p ${MSPORT_R} -c http://${CHOST} -m http://${MBHOST}${MSNAME_R}:${MBPORT}
        networks:
          - consul
        links:
          - mbreporting
          - consul
          - fabio
        depends_on:
          - mbreporting
          - consul
          - fabio
networks:
  consul:

volumes:
  publish-output:
    driver: local
    driver_opts:
      device: /mnt/d/Repositories/microservices.mocking/docker/PublishOutput
      o: bind

What I recieve as error from docker-compose when I try to start it using "docker-compose up".

ERROR: for reporting Cannot start service reporting: error while mounting volume '/var/lib/docker/volumes/betsreporting_publish-output/_data': error while mounting volume with options: type='' device='/mnt/d/Repositories/microservices.mocking/docker/PublishOutput' o='bind': no such file or directory

Running ls -la /mnt/d/Repositories/microservices.mocking/docker yields

drwxrwxrwx 0 root root 4096 May 30 16:12 PublishOutput

So host directory exists for sure, but docker-compose can't seem to find it for some reason. Why?

(*) My colleague is using volume of type bind, I tried with that, also didn't work for the same reason so I've decided to change the volume type, but then it seems like the root problem is that docker-compose can't seem to find the host directory.

Upvotes: 1

Views: 1885

Answers (1)

kuskmen
kuskmen

Reputation: 3775

After reset of Docker daemon credentials sharing for device window prompted and then after re-sharing the disk it started working again, even tho it was previously shared as well. I suspect that sharing of disk to Docker does not apply to directories created AFTER sharing was done (thus re-sharing was needed) but I am not entirely sure, will check that with docker engine guys.

One more thing, I was trying also to run it from Linux subsystem on Windows and it didn't work, I suspect that again permissions of Linux subsystem and Windows might be not matching or docker engine might have a bug, cause even after re-sharing error persisted so I had to run it from Powershell instead.

Upvotes: 2

Related Questions