running docker on the raspberry pi 3

These are early days for me, but I’ve managed to get Docker up and running on my Raspberry Pi 3 (quad core 1GHz ARMv7 (v7l), 1GB DRAM). I’m running Arch Linux. Here’s what ‘cat /proc/version’ shows:

Linux version 4.1.21-1-ARCH (builduser@leming) (gcc version 5.3.0 (GCC) ) #1 SMP Wed Apr 6 19:29:49 MDT 2016

In order to get Docker installed I ran ‘sudo pacman -S docker’ followed by ‘sudo systemctl enable docker’ followed by ‘sudo systemctl start docker’.

I have yet to learn how to create a container, but I have found at least one to download and run within my Raspberry Pi. I executed ‘sudo docker run -d -p 80:80 hypriot/rpi-busybox-httpd’. This starts a little httpd server which can be reached by any local web browser (i.e. inside the home network). For example, using Vivaldi:

You can read more about this particular container here: Getting started with Docker on your Raspberry Pi

Once up and running, there are some simple CLI commands to monitor and control what’s running:

  • ‘sudo docker ps’ returns a list of all running containers. The first entry in each line of the listing is the container ID, and it’s used to control it with other commands. If you want to see all containers, running or otherwise, execute ‘sudo docker ps -l’ (lower case L)
  • ‘sudo docker stop [containerID]’ stops a container.
  • ‘sudo docker start [containerID]’ starts a container. For stop and start remember to use ‘ps -l’ to get the container ID whether it’s running or not.

There is more to come, but for now this is a decent start. Software is installed and from what I can determine by examination the Raspberry Pi 3 is doing a decent job running Docker and at least one container. Not bad for a $35 computer.


3 comments

  1. Hello, following this gives me an error which on googling suggested that it’s an architecture error. I used the arch arm8 install instructions and installed docker like you had said. I get this:
    [root@alarmpi alarm]# docker run debian /bin/echo ‘hello’
    docker: Error response from daemon: rpc error: code = 2 desc = “oci runtime error: exec format error”.

    Did you happen to see this? Or know how to fix it?

    Like

    • Just ran an update (sudo pacman -Suy) and picked up the latest bits, including the Arch ARM kernel.

      I’m currently running with “Linux version 4.4.15-1-ARCH (builduser@leming) (gcc version 6.1.1 20160602 (GCC) ) #1 SMP Tue Jul 12 19:28:09 MDT 2016”

      I re-installed Docker, then re-enabled and restarted it. I then started the container. It all still works for me. No, I’ve not seen that error.

      Like

      • So, i managed to fix it. I had used debian instead of rpi-raspbian as the base image. (Silly me :( )
        Do you by any chance also have/had issues with exposing ports?
        I have something like this when i try:
        $ docker run -dit -p 6600:6600 -p 8000:8000 -v /dev/shm/:/music -v /dev/shm/:/music -v /dev/shm/:/mpd mpdocker
        2009bd688f001077cb27d796b81aaf16e9e8ac473b86f34460c974a6327d8f54
        docker: Error response from daemon: driver failed programming external connectivity on endpoint naughty_stallman (ab176e61389084b6cddd3d4ed3b322b5d7172d6df36903495e6b370f35e2ca98): iptables failed: iptables –wait -t nat -A DOCKER -p tcp -d 0/0 –dport 8000 -j DNAT –to-destination 172.17.0.2:8000 ! -i docker0: iptables: No chain/target/match by that name.
        (exit status 1).

        Everything i have looked at so far points to the kernel and that i have to recompile it to enable a module..

        Like


Comments are closed.