Reputation: 374
I am attempting to set up a project using Docker and Docker compose on Mac OS. I have however run into some problems trying to mount volumes.
My ubuntu:latest image works fine when I copy my main site folder in my Dockerfile:
COPY www /var/www/site
COPY apache-config.conf /etc/apache2/sites-available/000-default.conf
Although this works I need to be able to able to reflect changes to my code without having to rebuild. So I thought it would be easy just to use volumes in my docker-compose.yml file (removing the first copy line above in Dockerfile):
web:
volumes:
- ../www:/var/www/site
My docker-compose.yml file resides in the /build folder, all project files in /www.
No error messages when building or running docker-compose up but Docker does not seem to find its way. The only thing that shows up when I go to my home url is an empty "Index of /" Apache page.
What am I missing here?
Upvotes: 1
Views: 5012
Reputation: 28553
Based on the comments, it looks like you were running into the fact that the Docker Machine running on VirtualBox is only mounting the /Users
folder into the VM and thus anything outside your /Users
folder on the Mac wouldn't be able to be mounted into a container.
This is called out about halfway down on https://docs.docker.com/engine/userguide/containers/dockervolumes/:
If you are using Docker Machine on Mac or Windows, your Docker daemon has only limited access to your OS X or Windows filesystem. Docker Machine tries to auto-share your /Users (OS X) or C:\Users (Windows) directory.
Upvotes: 3