Docker Shared folder on windows

Docker is ultra hot right now. It`s becoming a standard very quickly.  There are some issues on IO and Network but still a very promising solution for prime time. If you are a developer and are working on a Windows machine docker is great for you because you can have linux almost for free :-) For Mac and Windows users we need use Boot2Docker. Boot2Docker is a very small image lass them 30MB and is ultra fast it uses tiny linux kernel. Let`s see how to have a shared folder in windows and a docker container using ubuntu inside docker :-) This should be included at the official boot2docker image at some point but for now or you build the image or you do a workaround.




Getting VirtualBox

Make sure you have the latest version of virtualbox installed. Youcan download it here: https://www.virtualbox.org/wiki/Downloads

Getting Boot2Docker

First of all you need get boot2docker, here: https://github.com/boot2docker/windows-installer/releases current version now is 1.6.2. There only one problem, boot2docker does not have support for Virtual Box Guest Tools :(.  You can read more on this pull requests:

https://github.com/boot2docker/boot2docker/issues/43
https://github.com/boot2docker/boot2docker/issues/232
https://github.com/boot2docker/boot2docker/pull/534

Workaround to have the shared folder working on Windows

First of all you need download the image(you can build a more recent image if you want go check the links on the previous session) with virtualbox guest tools instaled, you can get it here: http://people.renci.org/~stealey/boot2docker/boot2docker.iso You will need do replace your boot2docker image with this one, i recomed you do a backup. Your boot2docker should be installed here: C:\Users\YOUR_USER\.boot2docker\boot2docker.iso

You will need stop boot2docker with $ boot2docker stop and them run the virtualbox command.

Them you will need create a script to use the VirtualBox API in order to create the shared folder.
With this script you can run it like this to create your shared folder:

Once you do that you can start boot2docker with

$ boot2docker start
$ boot2docker ssh

Mounting the shared folder on docker(boot2docker)

Start your boot2docker and them enter in your console and type:

A Little Bit of Inception

Let`s see i want to propagate this shared folder to another container inside docker, lets use a ubuntu image, you can do like this(now there is a docker command for it :-) ):

Shared Folders with VirtualBox on Windows still slow :(. I did a simple benchmark running a simple Node.JS code on my windows and them on this ubuntu/docker and the performance with the shared folder is slow but it`s okay to have fun a learn docker. For something more professional i recommend you consider Docker-Machine with Amazon driver.


Popular posts from this blog

Kafka Streams with Java 15

Rust and Java Interoperability

HMAC in Java