I’m playing around with Hypriot OS – Docker on Raspberry Pi! I’ve got it set up with docker-machine so I can issue commands from my laptop.
I want my running container to have access to /dev
and /sys
on the Raspberry Pi so my code can communicate with the hardware. However, it would be nice if I could continue to mount the project directory in the container as well.
Right now I’m coding on my Macbook, then when I want to test I build a new image containing the code. Then, I SSH into the Pi and start the container there, so that /sys
and /dev
are pointing at the appropriate devices on the Pi (instead of nonexistent devices on my Macbook). I’d prefer to run the show entirely from my Macbook so I don’t have to rebuild the image every time I make a change.
Here’s an image somewhat explaining what I’m trying to do:
+-------------------------------+
| Raspberry Pi |
+--------------------+ |+----------------+ |
| Macbook | || Container | |
| | || | |
| ~/projects/abc <---------- /app | |
| | || /sys -------------> /sys |
| | || /dev -------------> /dev |
+--------------------+ || | |
|+----------------+ |
+-------------------------------+
Conceptually, I don’t think this is impossible. I use Docker Machine with Virtualbox and am able to mount my local working directory, so this is just a stretch to see if I can also access files on the device itself. Does Docker allow this kind of behavior?