$ docker-machine create --driver generic \
--generic-ip-address $host_ip \
--generic-ssh-user $host_user \
$machine_name
you can’t mount local volumes to remote server
but you can upload your files
with scp
or rsync
docker-compose
will mount file with the same path in both client
and remote
server
, you can check you path $ pwd
.
# download
$ docker-machine scp $machine:$src $dest
# upload
$ docker-machine scp $src $machine:$dest
# sync and delete file remote that not existed on local
rsync -rvzahe 'docker-machine ssh $machine' --delete --progress $src :$dest
# ignore .git directory
rsync -rvzahe 'docker-machine ssh $machine' --delete --progress --exclude='.git' $src :$dest"
# alias
export machine=digitalocean
# rsync for mount volume on remote docker host
# sync
alias dsync="rsync -rvzahe 'docker-machine ssh \$machine' --delete --progress --exclude='.git' . :\$PWD"
# remove file on server !!! danger
alias dclean="docker-machine ssh \$machine \"cd \$PWD && rm -r *\""
# need confirm before delete
alias dclean="echo \"cd $PWD && rm -r *\" | xargs -p docker-machine ssh \$machine"
# list dir on remote host
alias dlist="docker-machine ssh \$machine \"cd \$PWD && ls\""