I am using docker-compose and I would like to create a relative two-path binding.
Folder structure and path at the host machine:
/Users/username/Documents/Repos/docker-gulp-template/bla
docker-gulp-template
Dockerfile
docker-compose.yml
Bla (Folder)
Path structure inside the container:
/usr/src/html/bla
version: '3'
services:
bla:
command: /bin/bash
stdin_open: true
#tty: true
container_name: docker-gulp-template
#restart: always
build: .
ports:
- '80:3000'
volumes:
- "/bla:/usr/src/html/bla"
This one does result in an error.
ERROR: for docker-gulp-template Cannot start service bla: b'Mounts denied: \r\nThe path /bla\r\nis not shared from OS X and is not known to Docker.\r\nYou can configure shared paths from Docker -> Preferences... -> File Sharing.\r\nSee https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.\r\n.'
volumes:
- ".:/usr/src/html/bla"
This one does work.
I did found this thread: Docker: Mounts denied. The paths ... are not shared from OS X and are not known to Docker
but it didn't help me at all. I did try to add my repository-folder to the file sharing tab of the docker settings but it doesn't allow me to add the folder because it is already inside the group of /Users.
Is the path relative from the docker-compose/docker file?
Anybody got an idea what the problem is? I am really confused.
Thanks in advance
You can use relative paths, in your case it would be
volumes:
- "./Bla:/usr/src/html/bla"