Skip to content

Instantly share code, notes, and snippets.

@mjul
Created August 19, 2016 10:06
Show Gist options
  • Save mjul/bd0fbffe2f94bbf5a070d8d555f3414a to your computer and use it in GitHub Desktop.
Save mjul/bd0fbffe2f94bbf5a070d8d555f3414a to your computer and use it in GitHub Desktop.
RSync a local directory to docker-machine to make it available for VOLUME

Docker VOLUME directories are local directories on the docker host. Hence, when using docker-machine with remote hosts they are not available. However, we can rsync files to the remote docker host and MOUNT them from there

Local directory to docker-machine home directory

Assuming rs is a directory, this copies its contents to the home directory of the default user (ubuntu) on the remote docker-machine with the name my-sandbox. : denotes the remote machine, with no path it defaults to the current directory of the shell (the ubuntu user's home directory).

rsync -av -e 'docker-machine ssh my-sandbox' rs :
@brandontamm
Copy link

Does this actually work? Just a one-time rsync or does this rsync forever, in real time?

@simonmulser
Copy link

simonmulser commented Mar 22, 2018

rsync is a Linux file-copying tool - https://linux.die.net/man/1/rsync. so it is one-time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment