automatix
automatix

Reputation: 14542

How to make a mount shared in Docker?

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?

Upvotes: 14

Views: 18474

Answers (2)

Colin Eininger
Colin Eininger

Reputation: 729

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

Upvotes: 59

Pavel Trzaskalik
Pavel Trzaskalik

Reputation: 217

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

Upvotes: 1

Related Questions