I tried to mount folder of my project from /var/www to the same folder in container but folder in container is empty. Problem is maybe with host folder permissions because if i try that with some other folder it works.
This works:
docker run -it -v ~/Downloads:/var/www debian:jessie /bin/bash
This doesn't work:
docker run -it -v /var/www:/var/www debian:jessie /bin/bash
You cannot mount any folders outside your homedir ~/, this is the VM restriction on Mac and Windows. When the Virtualbox is created it mounts the folders within your Users directory, which makes it the only folder available to the containers https://github.com/docker/kitematic/issues/1192
By default, Machine will only share your home directory. If you want to add more, you need to add them using the VirtualBox UI.
https://github.com/docker/machine/issues/1814
In addition to vitr's great answer above, if you are using Dinghy with your docker containers, then on your local machine check the setting of
DINGHY_HOST_MOUNT_DIR and DINGHY_GUEST_MOUNT_DIR that the folder you are trying to mount is below what is specified in the above environment variables. If those env. vars are not specified then your home directory is assumed.
$ env | grep DINGHY_HOST_MOUNT_DIR
DINGHY_HOST_MOUNT_DIR=/Users/ro/my_docker_workspace
$ env | grep DINGHY_GUEST_MOUNT_DIR
DINGHY_GUEST_MOUNT_DIR=/Users/ro/my_docker_workspace
So in the case above, I can only mount local folders in my_docker_workspace and below.