I bounce back and forth between a Windows laptop and a CentOS workstation for my current project.  Now I’m working with Docker, which exists to containerize applications and let them be bundled or at least specifically describe what environment they need. Docker then makes that environment work, regardless of whether it’s on my development box, a test box, or a production box.  No more “but it needs version ‘foo’ to work properly and our system only has version ‘bar’ installed….”  However, in my CentOS environment Docker can work naturally directly, whereas in my Windows environment, it needs an intermediary to get to Docker goodness.  That intermediary is boot2docker, which exists for both Windows and OSX.

Once I’ve got boot2docker installed and am in, it’s now time to do a docker build.  In my case, I’m building against a local Dockerfile which exists on my laptop.  However, that file and its supporting resources all live outside of the context of the VM boot2docker spins up within which to run docker.  How could I mount a drive to share the files in?

The approach listed in boot2docker’s README.md to mount a drive didn’t work for me.  Or, more properly, I was able to set up a mounted drive.  It just wasn’t one that I could write to from my development box. I could look in it, but not write to it. Unsure why.  However, apparently relatively recently boot2docker added the ability to go to /c/users – see the first comment on this post, which described a _different_ way to map drives.  (I looked at 3.)  The boot2docker default mapping doesn’t look at the rest of c.  Just /c/users.  Thankfully, my stuff already lived in a nested directory below.

Mission for the night accomplished: Docker file refactored to run with a different base image, one that assumes everything’s pre-built rather than does magic things to have a Maven build happen in the Docker container.  That makes the world much nicer for things like new unit-tests that depend on having a Mongo database around…  Too bad all of that wasn’t in my sprint task list.  But having a non-breaking build is a wonderful thing.