Docker is a relatively new technology, only appearing just over four years ago. The core building blocks have always been part of Unix; but the significant support, Linux containers (LCX), first appeared back in 2008.
Initially Docker was only supported on Linux, but more recently native support for OSX (my development OS of choice) and Windows (albeit Windows 10 Pro) suddenly opens up some interesting workflow choices.
So, first, what is Docker? I’m always trying to find the right words here that does Docker justice but doesn’t over simplify the technology. A one-liner is:
“A lightweight Virtual Machine”
The danger of this over-simplified statement is the natural follow-on questions trying to compare Docker to, say, a hypervisor technology such as VirtualBox.
Another one-liner I try is:
“It’s like a Linux process with its own file system and network connections”
However, a fuller description is:
“Linux containers are self-contained execution environments—with their own, isolated CPU, memory, block I/O, and network resources—that share the kernel of the host operating system. The result is something that feels like a virtual machine, but sheds all the weight and startup overhead of a guest operating system.”
So, Docker allows me to wrap up a program and all its dependences (e.g. python tools, libraries, etc.) into a single, isolated executable environment. The wrapping up of the program and its dependences is called a Docker image; when image is executed it runs as a Docker container.
Probably more importantly is “Why would I use Docker as an Embedded developer?”. Most of the current Docker development is in the field of DevOps called “microservices” where Docker is being used to deploy applications. This is, currently, far removed from most embedded systems and I won’t address here. [ See Getting started with Docker on your Raspberry Pi if that floats your boat]
How, then, can Docker help an Embedded developer?
Some of the key benefits are:
- For anyone not developing on Linux it opens up the world of Free Open Source Software (FOSS) that quite often are not available on other platforms (or difficult to install)
- It allows developers to use tools in their local development environment without having to install them (even if there is a build available).
- It allows code to be checked against variants of toolchains without the struggle of tools co-existing
- It ensures all team members are using exactly the same tools and build environment
- It ensures my build server (e.g. Jenkins on Linux) is building against the same tools used in development and vice-versa.
- It allows me to create a virtual TCP/IP network of separate applications on a single machine
- It allows me to experiment with support technology without having pollute my development machine (e.g. run a local nginx HTTP server as a target for my IoT development in a Docker container)
There are plenty more good reasons to look at Docker which I’m sure you’ll start to see as you get use to it.