Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 533
automatix Avatar asked Jul 06 '21 15:07

automatix


People also ask

How do I enable file sharing in Docker?

In order to share Windows folders with Docker containers, you first need to configure the "Shared Drives" option in Docker settings. Once the Shared Drives option is configured, you can mount any folder on shared drives with the "-v" (volume) flag.

Can a Docker container be shared?

To share Docker images, you have to use a Docker registry. The default registry is Docker Hub and is where all of the images we've used have come from. A Docker ID allows you to access Docker Hub which is the world's largest library and community for container images. Create a Docker ID for free if you don't have one.


Video Answer


2 Answers

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
like image 111
Colin Eininger Avatar answered Oct 13 '22 00:10

Colin Eininger


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
like image 22
Pavel Trzaskalik Avatar answered Oct 12 '22 23:10

Pavel Trzaskalik