14

I'm trying to start a project in Docker (directly from the Debian distro) in Windows 10 and getting this error:

$ docker compose up -d
[+] Running 0/0
 ⠋ Container core_php74_1  Creating                                                                                                                            0.0s
Error response from daemon: path /home/me/path/to/project is mounted on / but it is not a shared mount.

How to make the mounted path /home/me/path/to/project a shared mount?

automatix
  • 14,018
  • 26
  • 105
  • 230

2 Answers2

59

I got the same error after updating docker for desktop to 3.5.2 (66501). I have created volumes with trailing slashes in my docker-compose.yml. I removed them to fix the problem.

Change

volumes:
  - ./:/app/
  - ./another/folder:/folder/

To

volumes:
  - ./:/app
  - ./another/folder:/folder
Dharman
  • 30,962
  • 25
  • 85
  • 135
Colin Eininger
  • 719
  • 4
  • 5
  • 2
    Thanks a million Colin for your useful fix. I fixed the issue just like what you said. Don't know why it only affects Windows 10 with docker desktop 4.0.0 (67817) but it works on my Mac. – userIndulgeInDChord Sep 15 '21 at 06:32
  • I just wanted to chime in that I was having this issue and it had to do with trying to seed my MySQL database with `/docker-entrypoint-initdb.d/:ro`, which wasn't working anyways to automatically run my database seeds. Removing the `/:ro` resolved the issue for me. – Kyle Crossman Oct 28 '21 at 14:41
  • @KyleCrossman You could've remove only the trailing `/` so your configuration would've be `/docker-entrypoint-initdb.d:ro`. `:ro` is for read-only – Colin Eininger Nov 02 '21 at 10:08
  • just want to report this happening on win10 docker desktop 4.2.0 (70708) – Edoardo Nov 25 '21 at 16:48
1

You can NOT mount into docker to "/" In your docker-compose.yml must be this lines or similar for windows :

volumes:
  - /home/me/path/to/project:/path/in/image
  • 1
    Thank you for your answer. But this configuration is working on Linux hosts. So the mounting itself will be correct. Otherwise, it would not be possible to start the container(-s) anywhere. – automatix Jul 09 '21 at 14:52