Developing Arduino with Docker

Jul 13, 2015

It is easy with Docker though. Let’s see how we can upload our first program
to Arduino Uno without installing anything apart from Docker.

Kernel Modules

For Arduino Uno I need to enable

Device Drivers -> USB support -> USB Modem (CDC ACM) support

as module.

Then I compiling and loading it with

make modules && make modules_install && modprobe cdc-acm

in my /usr/src/linux. At last I connect Arduino and see it as /dev/ttyACM0.

Installing ino

For this we just need image from hub.docker.com:

docker pull coopermaa/ino

It’s slightly outdated, but I sent
PR to use new base image,
because that’s how we do this in opensource world. Anyway it works great. Let’s
create script for calling ino through Docker, add next script to your $PATH

Uploading program

Vim integration

I’m using Vim plugin for ino, you
can easily install it with any plugin manager for vim. You don’t need anything
special, it’ll just work. You can compile and upload your sketch with
<Leader>ad.

Known issues

For using ino serial you need to add -t to docker run arguments to your
script. It works pretty weird though, you need to kill process
/usr/bin/python /usr/local/bin/ino serial by hands every time, but it works
and looks not so bad.

Also files created by ino init will belong to root, which isn’t very
convenient.