Note: this applies only to Macintosh and Windows users. Linux users do not need a virtual machine to run Docker, as it, and its filesystem, run natively.
Divio Shell Required
By default, boot2docker (the lightweight Linux virtual machine that hosts your Docker containers locally) will only mount directories from your host system into the VM if the directory is in the filesystem's user space.
This means there are limitations as to where you can place your Divio Cloud project.
- Macintosh: the project must be in the /Users path
- Windows: the project must be in the C:\Users path
Trying to run an Divio Cloud project that is outside these default locations will typically fail with an "ERROR: No container found for web_1".
If you need to set up your Divio Cloud projects outside of those default locations, you have to mount these locations into your virtual machine explicitly.
Step 1: Create the Virtualbox share
Run the following command for adding a shared folder to the VM (in our example /divio or D:\divio respectively)
# OS X
VBoxManage sharedfolder add default -name /opt/divio -hostpath /divio
C:\Program Files\Oracle\VirtualBox\VBoxManage sharedfolder add default -name /opt/divio -hostpath d:/divio
Step 2: Configure the virtual machine
Now we connect to your virtual machine via SSH. Please make sure it's running. Then, open a terminal/shell window and run the following commands:
# connect to the virtual machine
docker-machine ssh default
# change user to root
# Create a new file bootlocal.sh
echo "sudo mkdir /divio && sudo mount -t vboxsf /opt/divio /divio" >> /var/lib/boot2docker/bootlocal.sh
# Run it once to create the mounts now
# Exit by typing exit twice
Now, your host folder (/divio or D:\divio respectively) is available at /divio inside your virtual machine
Step 3: Configure your project
Lastly, we have to configure your Divio Cloud project. This is only necessary if you're on Windows. On Mac OS X this is taken care of automatically.
Open the docker-compose-windows.yml configuration file and find the service web, go to the volumes section and make the following modification:
Save and close the file, then open a terminal again and change directory into your projects folder, and run the following command to rebuild the containers:
docker-compose -f docker-compose-windows.yml rm -f
divio project up
And that's it! If you're having any problems, please contact our support.