|Docker Comes To Pi - It's Official|
|Written by Mike James|
|Wednesday, 31 August 2016|
Docker is either a revolution about to happen or something that will fizzle out quite soon. Having an official presence on the Raspberry Pi might be another step to dominance.
Docker is a strange idea and to a large extent it is a testament to our failure. It is a fix-up patch that makes it possible to ignore the over complex environments that our programs have to operate in.
In an ideal world you would be able to write a program and distribute it with the expectation that it would run without modification on any operating system the user had. Back in the early days of DOS, or in the early days of any operating system, this is more or less true, but as time goes on libraries, DLL, shared libraries and so on proliferate and there is no standard operating environment any more. Today, you can add to this the problems of security and permissions and you have no choice, but to start out with the expectation that your code will not run. Well, it will not run unless the user goes to some trouble to adjust the environment so that it can run.
Docker is a solution to the problem of not providing a standardized environment. Instead of a standardized environment, Docker provides a custom environment that you prepare for your app. You place your code inside Docker and provision it with everything it needs in its own little container. As long as Docker runs on an operating system, your container will allow your app to run. We are back to the days when your app "just worked". It isn't quite a rosy as this because the user still has to be running an OS that supports Docker and they have to install and perhaps configure Docker, but they only have to do this once.
So, put simply, Docker lets you bundle all your app's dependencies into a single container which can be run on any OS or machine or in the cloud.
Raspberry Pi is incredibly popular because it offers so much power for so little cost. However, it runs a full installation of Linux - Raspbian - and getting your apps to run can involve a lot of assumptions and a complicated installation script. Docker on Pi means that you can package up your app and ship it as a Docker container and get the user to run it with a simple command.
To install Docker the user simply types:
You can also set Docker to autostart using systemd.
Then to run a Docker image:
There aren't many ARM compatible images that you can use to base your own images on. Currently there are no official images and things are in the experimental stage. There is a basic Raspbian Jessy image that can be used to host your own programs and you can arrange to access the GPIO lines. This makes it possible to use Docker to distribute IoT applications. Could this be the killer mass market app that Docker was made for?
You can also use the Docker Swarm program to run multiple copies of a Docker image on a stack of Raspberry Pis. It used to be fun to put together say five or six Pi A or Bs to create a cluster, but now it seems that with the $5 Pi Zero you can stack a lot more machines. In this case the USB port is used in place of a network connection.
Using Swarm isn't the solution to every super computer problem but it does provide a way of increasing the number of servers available - assuming you don't need a lot of bandwidth between the machines.
It will be interesting to see availability on the Pi boosts Docker's use. It probably all depends on the quality of the documentation and improving the ease of use.
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on, Twitter, Facebook, Google+ or Linkedin.
|Last Updated ( Wednesday, 31 August 2016 )|