Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Containers not mounting shared sources correctly #20

Closed
phpguru opened this issue May 15, 2015 · 1 comment
Closed

Containers not mounting shared sources correctly #20

phpguru opened this issue May 15, 2015 · 1 comment

Comments

@phpguru
Copy link

phpguru commented May 15, 2015

I am able to view the contents of NFS shared files inside vagrant ssh at the path /vagrant however my folders from Mac are not showing up in the /src directory where the run command mounts them. With docker run command:

      docker run -d \
      -P --name db \
      -e APP=db \
      -e MYSQL_ROOT_PASSWORD=ROOTPASSWORD \
      -e MYSQL_USER=DBUSERNAME \
      -e MYSQL_PASSWORD=DBPASSWORD \
      -v /Users/username/Sites/mysqldata:/src \
      mysql

The config above worked with boot2docker, but now that I've migrated to boot2docker-vagrant-box, the mount works into the vagrant box, but my /src directory in the mysql container is empty. The src dir is created though and looks like this:

docker@boot2docker:~$ docker-enter db
root@89649480e099:/# df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           1.4G   97M  1.3G   8% /src
/dev/sda2        39G   20G   18G  53% /var/lib/mysql
/dev/sda2        39G   20G   18G  53% /etc/resolv.conf
/dev/sda2        39G   20G   18G  53% /etc/hostname
/dev/sda2        39G   20G   18G  53% /etc/hosts

What am I missing?

@phpguru
Copy link
Author

phpguru commented May 15, 2015

Answering my own question, the paths change from the Mac full system path, to the full system path of the NFS share inside the vagrant box, by default, /vagrant, so:

with

config.vm.synced_folder ".", "/vagrant", type: "nfs", mount_options: ["nolock", "vers=3", "udp"], id: "nfs-sync"

in Vagrantfile, use

      docker run -d \
      -P --name db \
      -e APP=db \
      -e MYSQL_ROOT_PASSWORD=ROOTPASSWORD \
      -e MYSQL_USER=DBUSERNAME \
      -e MYSQL_PASSWORD=DBPASSWORD \
      -v /vagrant/mysqldata:/src \
      mysql

to mount the appropriate folder inside the container. See the -v switch setting specifically.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant