16 septembre 2014

Boot2docker (eventually) includes Virtualbox guest addition

First try you gives Docker a try,  you get excited how easily the target environment can be reproduced and how fat you can start a "container" compared to virtual-machines.

Then you start considering using Docker for your own development (as it might be hard to convince production guys to adopt a tool that was just released as 1.0 few month ago). As you use a Windows or Apple computer, you will rely on boot2docker. That sounds good ... until you start building non trivial applications.



Running 'docker build' from your computer will send all local directory to the docker vm so the Dockerfile can access project resources, this can take some time but this works. If you use the "code, build, restart" approach, things will be mostly ok, as you just change the commands to be used.

But if your software stack only require to update source code, for sample as you develop an Angular frontend, or rely on modern stack with hot-reload capabilities, thinks become crazy : developing with Docker make you far slower than local development.

The "live-reload" approach is possible with Docker, but require direct connection from your IDE to the folder used by your application container. Docker volume option can mount a directory from host into container, but you're not working on the host - that is your boot2docker VM. 

Request to include VirtualBox guest additions in boot2docker, so the VM can share your $HOME directory, and let you get local file accessed from container using a volume is a long running issue on boot2docker issue tracker. There's lot's of reason to explain this has been rejected :

  1. boot2docker hasn't been designed as a development helper, but as a minimal OS to run docker containers. So it's not tied to Virtualbox
  2. a better option would be for windows/osx docker client --volume option to support remote mount, using some client-daemon communication as transport. But that's not trivial :)
Some experimented with a Samba server running in boot2docker VM, so you can access it from your development environment as a (actually local) remote directory. I didn't tested it but this just looks like a hack, and is a huge entry barrier for newbies.

This morning I had the surprise to see this pull-request being merged :


You can read the discussion there for more details, but the main point is 
"boot2docker" currently is essentially the "Docker daemon for Mac OS / Windows"

That's a major point, and nice to see the boot2docker team consider the way the project is actually used in docker community. Docker ecosystem is full of talented developers, with impressive skills and knowledge on low level system stuff and virtualization constraints. But Docker topic is to make this simple and offer a common interface to all underlying technologies. Docker main benefit is that a developer - even a junior Java EE developer - can use it to run his application on a Windows workstation then reproduce this stupid "UTF-8 Invalid Byte Sequences" bug.


This ended up with docker CTO Salomon Hykes escalating this issue as a major Docker-wide one. There have been an active debate, but we eventually get it fixed. Thank you guy to take care of your community !





0 commentaires: