Created on 02-27-2020 08:41 AM - last edited on 02-27-2020 12:33 PM by ask_bill_brooks
hi all,
in general, it is very easy to mount folders from local/host to container
Any suggestions to mount folder inside container to local/host like
-v /path_folder_in_container/:/path_folder_in_local/
or
-v /path_folder_in_container/:/path_folder_in_host/
Many thanks
Created 03-03-2020 11:08 AM
@thuylevn I found this somewhere you can try this.
You could do this using the docker-machine mount command.
Using this command,you can mount directories from a machine to your local host, using sshfs.
The notation is machinename:/path/to/dir for the argument; you can also supply an alternative mount point (default is the same dir path).
consider an example:
$ mkdir foo $ docker-machine ssh dev mkdir foo $ docker-machine mount dev:/home/docker/foo foo $ touch foo/bar $ docker-machine ssh dev ls foo bar
Now you can use the directory on the machine, for mounting into containers. Any changes done in the local directory, is reflected in the machine too.
$ eval $(docker-machine env dev) $ docker run -v /home/docker/foo:/tmp/foo busybox ls /tmp/foo bar $ touch foo/baz $ docker run -v /home/docker/foo:/tmp/foo busybox ls /tmp/foo bar baz
The files are actually being transferred using sftp (over an ssh connection).
Created 03-05-2020 12:42 PM
Hi @GangWar ,
Thanks for your sharing, how ever I tried with image
apache/nifi:latest https://hub.docker.com/r/apache/nifi/
My expectation is mount folder /opt/nifi/nifi-current/conf (inside nifi-container) to folder nifi (in docker-machine). However it doesnot work.
Do you have any suggestions?