I'm pretty comfortable using Docker recently, typically to test websites to make sure they run properly on servers before I deploy them.
Typically, I mount my local directory to the locally running image like:
docker run -v c:\temp\website:/var/www/html (you get the picture)
What I am curious about is if there is a way to mount my local volume to a remote server running docker. I'm pretty sure the answer is no, unless I poke wholes in firewalls and such to make a local volume share externally.
But, I thought I would ask. Docker seems to be doing some amazing things quickly.
How to Mount Local Directories using docker run -v. Using the parameter -v allows you to bind a local directory. -v or --volume allows you to mount local directories and files to your container. For example, you can start a MySQL database and mount the data directory to store the actual data in your mounted directory.
You can manage volumes using Docker CLI commands or the Docker API. Volumes work on both Linux and Windows containers. Volumes can be more safely shared among multiple containers. Volume drivers let you store volumes on remote hosts or cloud providers, to encrypt the contents of volumes, or to add other functionality.
To mount a data volume to a container add the --mount flag to the docker run command. It adds the volume to the specified container, where it stores the data produced inside the virtual environment. Replace [path_in_container] with the path where you want to place the data volume in the container.
Multiple containers can run with the same volume when they need access to shared data. Docker creates a local volume by default.
\\windowsip\website
.sudo apt install cifs-utils
sudo mount -t cifs -o user=******,password=******,uid=ubuntu,gid=ubuntu //windowsip/website /home/ubuntu/website
docker volume create --driver local --opt type=cifs --opt device='//windowsip/website' --opt o='username=*****,password=*****' website
docker run -v website:/var/www/html
I know it is an old thread but just I had the same problem, hope it helps to others
Okey Okey I didn't read the last part of the question. Yes, you need to poke holes in the firewall. But still is useful, I have a linux server with docker and I use it via VPN when I work from home in my laptop. The container has local access to everything.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With