Docker Daemon failing to start on Raspberry Pi 1 & Zeros

Have you recently attempted to install the containerization platform known as Docker on to a first generation Raspberry Pi (including A+ and B+) or a Zero and found you couldn’t start up a container? Maybe you were trying your hand at deploying a internet advertising blackhole, Pi-Hole of your own? Whenever you attempt to integrate the daemon, you are met with less than positive responses?

Try checking the SystemD service logs for Docker with the following command:

journalctl -u docker.service

Did you see any errors? Something similar to the below?

Feb 18 20:07:24 raspberrypi systemd[1]: Starting Docker Application Container Engine...
Feb 18 20:07:27 raspberrypi systemd[1]: docker.service: Main process exited, code=dumped, status=11/SEGV
Feb 18 20:07:27 raspberrypi systemd[1]: Failed to start Docker Application Container Engine.
Feb 18 20:07:27 raspberrypi systemd[1]: docker.service: Unit entered failed state.
Feb 18 20:07:27 raspberrypi systemd[1]: docker.service: Failed with result 'core-dump'.
Feb 18 20:07:27 raspberrypi systemd[1]: Stopped Docker Application Container Engine.

It seems you have run in to the core dump / segmentation fault issue that is facing a lot of people across the community and is currently being explored over at the Moby (open source project for Docker) Github.

Fortunately there is a relatively easy work around. So if you are experiencing the above, follow the bouncing ball below to get back up and running.

Remove latest version of Docker

Utilising the purge command for from the apt package manager, we will clear out all instances and related applications for the community edition of Docker:

sudo apt-get purge docker-ce

Update apt cache and identify older version of Docker

While not strictly required, it’s worth noting how to use this feature of apt in future situations. First, update the cache of available applications with:

sudo apt-get update

Next, we will check what versions of Docker are available for installation with:

apt-cache policy docker-ce

You should get a similar output to the below whereby the installed version, followed by which version will be installed next (read: candidate) if you perform a sudo apt-get upgrade are listed at the top. Lastly, what versions in the apt cache catalogue are available for installation are listed out:

You’ll note the currently installed version is highlighted in the list of available versions with *** prior to it’s listing.

Install known working version of Docker

Based upon the feedback in the GitHub issue tracker, it’s a safe bet to install version 18.06.2. Let’s go ahead and install with the following command:

sudo apt-get install docker-ce=18.06.2~ce~3-0~raspbian
Note: earlier version of this post had listed 18.06.1 as the recommended version to install but having since tested 18.06.2 which includes fixes for CVE-2019-5736  
successfully, I have since changed the recommendation

As you can see, it’s very simple to specify a specific version of a application. All you need to do is add =versionnumber to the typical apt-get install application command and it’s done.

Confirm working Docker status

Now that we have the known working version of Docker installed. Let’s double-check our work by entering the following to get the Docker daemon’s status:

systemctl status docker

If you are all up and working, you should see active (running) like the below image:

No more segmentation faults, just back in business.

Advertisements
James Written by:

3 Comments

  1. Michael
    12/06/2019
    Reply

    James, Which version and type of Operating System are you running on your RaspberryPi for the instructions above? I tried this on a Pi Zero W with Raspbian Stretch and could not get the proper behavior when running ‘docker run hello-world’ It downloads the image, runs it, but I don’t get the usual output on the screen, and no logs from docker either… Any ideas what might be wrong here?

    • 13/06/2019
      Reply

      Hey Michael. I am running the Raspbian Stretch Lite build from 13/11/2018.

      In terms of the hello-world container; what do you get when running ‘docker ps’? It’s quite possible when you pulled down the ‘hello-world’ container, it wasn’t a ARM32v6 compatible image? Try running the hello-world container from the amazing pirates over at Hypriot (hypriot/armhf-hello-world) and see if you get the desired result. Or hell, just into with a bash terminal in the container with ‘docker exec -i -t CONTAINERNAME /bin/bash’ and have a poke around?

  2. On my Raspberry PI Zero V1.3, I tried “18.06.3~ce~3-0~raspbian” (one prior to the “default” which appears to be sad, as you mention). It also has issues during the install and will not start docker. I am restarting the process to use “18.06.3~ce~3-0~raspbian”, as your article suggests. It resulted in a different pattern of failure (not the “code=dumped, status=11/SEGV”). So, I restarted back to the specific version listed as installed on your system (and referred to in the comments). I did also reboot after the ‘apt-get purge’ step — just for completeness.
    Now docker.service is started and happily doing it’s “stevedore” jobs on my containers.

    Many thanks for your detailed fix for my “older” hardware!

Helpful? Have a question on the above?