Here at resin.io, we always strive to remove pain and strife from the lives of the developers building fleets of connected devices. While supporting these developers over the last year or so to build fantastic products and projects, we noticed that our initial docker base images just didn't cut it anymore. So we did a complete overhaul of our official image range.
TL;DR
Often times we saw users, especially those new to the world of
Docker, making the same errors and struggling with the same issues. So from this information, we set out to build a new set of base images for all our
supported devices. The goal of these base images was to create a solid base for users to get started with resin and feel at home in the container environment. From these images, users should be able to get up and running faster and with less hassle. Once they have a feel for it, they could trim the images down to be as slim and responsive as they need.
Base Images Tree
If you see our
base image documentation, you will notice that our new images now have a tree like structure, where the parent of all our images for a specific architecture is the barebones Debian image.
From there we build up, adding a systemd based image and then all the device specific stuff (firmware, source lists, etc). Finally, at the top of the tree we have language specific base images with useful libraries and tools bundled in. These are the images we recommend starting with and slowly cutting back as you move towards a production environment.
Systemd In the Container
Perhaps the most noticeable change is the addition of the
systemd init system on all the
Debian Jessie images. This change allows the containers to seem more like fully fledged linux environments.
Currently the systemd init system doesn't start by default, but rather has to be enabled using an environment variable. For example:
FROM resin/edison-python:latest
# Enable systemd
ENV INITSYSTEM on
# Your code goes here
Alternatively you can set INITSYSTEM in your dashboard and toggle it on and off from there.
The beauty of having systemd running in your container is that it takes care of udev and adding nodes to /dev which is one thing that has tripped up many a resin user in the past.
Systemd also prevents the container from closing after your code has crashed or finished running. This is really great for exploring and debugging your container during development, since it allows you to ssh in or use the webterminal and run simple commands in the container or inspect system logs from your crashed process.
However, systemd isn't the silver bullet to kill all your container woes. Switching to the systemd images can sometimes cause headaches if you don't know what services are running. One example of this is
sshd. Systemd by default will run a socket activated ssh daemon if you have something like
openSSH installed. Now the headaches start if you try to start your own ssh daemon on a different port using something like
/usr/bin/sshd -p 1234. In this case the systemd sshd process overrides your own and the sshd will default to port
22.
In most cases the headaches are cured quickly with some systemd man pages reading, but these types of clashes should be kept in mind. Systemd also has a ton of other useful features and tricks. Have a look at this article on
"Getting Started with Systemd on Debian Jessie", for some insight on managing services with systemd.
Besides Systemd we also added some smaller touches to our base images. We now install most of the tools users would need while developing systems, things like i2c-tools, usb-tool and all the firmware and source lists relevant to each device type.
In some instances we have even installed popular GPIO and peripheral libraries. For example, both the
resin/edison-python and
resin/edison-node base images now have
libmraa and their respective language wrappers pre-installed. Have a closer look at each of our base images and what is installed in them over in our
documentation.
So give our new base images a shot! We are sure you will love them, and as always, if they give you even a mild headache or you just want a bit of clarification, just ping us on our
forum or
send us a message.
Have questions, or just want to say hi? Find us on our
community chat.