23

How would I go about running Docker (https://www.docker.io) on Raspbian?

The instructions I've found are either a very manual process based on Raspbian but with a very old kernel that seemed to require a bunch of patches. There's also the well-known build by the resin.io folks, but it's specifically made for Arch Linux.

Current Raspbian kernel is 3.10.25 which is modern enough to have most of the stuff that Docker needs. I'm not above building a new kernel, but is that still necessary?

Has anyone figured out how to get Docker and its requirements going on the Pi?

  • Interesting question. I'll also be interested in an answer to this. Have you tried those instructions at all? – Jivings Apr 24 '14 at 18:46
  • 1
    No, I've read all I could find. I'm specifically looking to use Raspbian so the Arch instructions weren't very useful. The Raspbian instructions by Ken Cochrane seem very old, requiring many steps to even get Raspbian up-to-date, let alone Docker, and don't even result in a working setup. I was hoping to gather some info before spending a ton of time on it. – Martijn Heemels Apr 26 '14 at 22:12
  • 1
    One this I've realized is that Docker containers aren't really cross-architecture. Since the containers share the kernel with the host-OS, the applications inside the containers are bound to the armv6 architecture. You can't build a docker image on x86 and run it on armv6, which puts limitation on your build system. There's a base-image available here: index.docker.io/u/resin/rpi-raspbian – Martijn Heemels Apr 26 '14 at 22:19
  • So it's possible but not to do what you want? – Jivings Apr 27 '14 at 17:21
  • 1
    Well it looks like their claim self-sufficient container that will run virtually anywhere is falling short. It sounds like for it to run on something, docker needs to be compatible with the device its running on. It sounds like Mono or Java which are more promising, but not really what you need. Why do you need this on the Pi any way? If you developing for Linux, you should really develop in what it supports natively. – ppumkin Apr 28 '14 at 19:14
14

Yes, I have built a kernel and ported Docker 1.0 to the Raspbian OS: Linux raspberrypi 3.10.37+ #1 PREEMPT Sat Apr 19 13:28:05 UTC 2014 armv6l GNU/Linux

I have shared my outputs on GitHub to save others the pain. As is usual I have provided this 'as-is' with no warranty ;-)

You can find the kernel & docker tar file here:

https://github.com/stevef1uk/docker_for_rpi

7

You can also use HypriotOS, which provides the latest Docker and Linux kernel for Raspberry Pi. Just flash the image and see Docker up and running!

http://blog.hypriot.com/

(disclosure: I am a team member of Hypriot)

  • Thanks, using your new image on my new Pi2. Works great! I've tried it with a variety of armhf images from Docker Hub. – Martijn Heemels Mar 4 '15 at 21:28
  • You are welcome! Thank you for the feedback! – Mathias Renner Mar 6 '15 at 16:08
  • 1
    @MathiasRenner is there a reason hypriot is not open source? Are you planning to monetize on the image? – jottr Jul 21 '15 at 22:00
  • 1
    @jottr Thank you for your interest! Actually, everything from Hypriot you need to run Docker on RPI is open sourced. You need (1) a proper kernel (github.com/hypriot/rpi-kernel-builder) and (2) the Docker binary (github.com/hypriot/rpi-docker-builder). Just build and install both and you are ready to go! – Mathias Renner Jul 23 '15 at 14:14
  • @MathiasRenner ah great! Thx for the pointers. – jottr Jul 24 '15 at 15:14
3

If you use Raspbian:

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install docker.io docker

Docker is now in the default repository,

Update: unfortunately this version is quite old, so pulling in images from Docker Hub won't work at the moment.

  • The version in the default repo is super old, 1.3.3 as of this comment. It no longer works with the docker registry making it mostly useless. – DriverDan Mar 27 '16 at 19:06
  • Agreed. Hopefully the package in Raspbian will be updated soon, maybe a bug/feature request will help – Janghou Mar 31 '16 at 9:52
  • There's 1.8.3 (October 2015) in the Raspbian testing repository. – nphx Apr 3 '16 at 6:57
  • See blog.hypriot.com/post/your-number-one-source-for-docker-on-arm for Docker 1.10 on Raspbian Jessie. – Arjan May 1 '16 at 13:20
3

Docker supports ARMv6/v7 and even ARM64 (v8?), so you can run it on your Raspberry Pis.

Follow the official instructions from Docker here: https://docs.docker.com/engine/installation/linux/docker-ce/debian/

If you have Raspbian Jessie or Stretch (check the above documentation for others), this would be:

$ sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
$ curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -
$ echo "deb [arch=armhf] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
     $(lsb_release -cs) stable" | \
     sudo tee /etc/apt/sources.list.d/docker.list
$ sudo apt-get update; sudo apt-get install docker-ce
$ sudo systemctl start docker

You can then test it (thanks to Docker multiarch support):

$ sudo docker run --rm hello-world

In order to avoid typing sudo for every Docker invocation, you can do the following extra steps: https://docs.docker.com/engine/installation/linux/linux-postinstall/

Enjoy!

PS: I've installed Ubuntu Server 16.04 for armhf. I have then followed these instructions (for Ubuntu) to install Docker on it: https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#set-up-the-repository. It works like a charm as well.

2

I have always used...

curl -sSL https://get.docker.com | sh && sudo usermod -aG docker pi

However, I just saw a deprecation notice this morning...

WARNING: raspbian is no longer updated @ https://get.docker.com/
         Installing the legacy docker-engine package...
  • I just noticed this too - do you know what it means? What are the implications of this? – meowsqueak Aug 18 '17 at 4:20
  • It means it works today, but it probably won't work tomorrow. It also means you should write to the moby project (i.e. the folks that maintain docker), tell them how awesome it is and beg them to please keep maintaining it. :D – Zak Aug 18 '17 at 6:31
  • Do you know if there's an alternative? Presumably I could always fall back to the manual installation process on Raspbian? – meowsqueak Aug 18 '17 at 22:26
  • No, I don't know. However, the Moby Project should be able to answer that question. – Zak Aug 18 '17 at 23:44
  • Thanks, I'm reaching out. I'd hate to see Docker disappear from raspbian - running microservices via Docker on a RPi is amazing... – meowsqueak Aug 20 '17 at 0:58

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.