Install Docker On Raspberry Pi 4 Ubuntu

The first service we will add to the Raspberry Pi is a DNS server, AdGuard Home, running in its own docker container. Blocking trackers, analytics and privacy infringing ads on a DNS level is a great way to make it network wide since ad blockers like uBlock Origin only blocks this kind of stuff in the browser. Basic Docker Install. On each of the Raspberries that you’d like to be your docker cluster run the following. We’re going to download a script from and run it to do an automated install. Curl -fsSL -o Add the pi user to the docker group. Dec 12, 2019 Contents. How to Install Docker on Raspberry Pi. Step 1: Update and Upgrade. Step 2: Download the Convenience Script and Install Docker on Raspberry Pi. Step 3: Add a Non-Root User to the Docker Group. Step 4: Check Docker Version and Info. Step 5: Run Hello World Container. Raspberry Pi Docker Images. To install Docker, run the following two commands on your PI (either directly or via SSH): sudo apt update -y. Curl -fsSL -o && sh This is going to be a really short post, and serves more as a “note to self” than anything else. Last week I finally allowed myself to purchase a Raspberry Pi 4, with.

This article explains how to install Docker on a Raspberry Pi, how to build a simple image, and how to run a container based on it.

Update 19/12/20: Unfortunately this procedure is temporarily broken. Due to a bug in libccomp2 and for other reasons, the docker build command fails with signature errors, and I have not been able to find a stable, repeatable solution. Hopefully it will start working again with future Raspian/Debian updates. When that happens the article will be updated. For now, do not use the following procedure.

Docker provides a mobile execution environment in which to run software. It is a very popular container technology. Docker is useful in the rapid deployment of applications and in application isolation. It is a valuable tool for developers, users and systems administrators. In this procedure, it will be used to install a simple video processing application called “comskip“.

Although the article is entitled Install Docker on Raspberry Pi, this procedure will work unaltered on most Linux distros, which is one of the advantages of Docker.

Besides acting as a demonstration for those wanting to learn about Docker, this article is aimed at readers of my previous articles How to Watch and Record Live TV with a Raspberry Pi and How to Install Comskip on a Rasperry Pi (without Docker).

Install Docker

Use the following command to install Docker.

Install docker on raspberry pi 4 ubuntu windows

wait a few minutes for the install to complete.

Create a Docker File

A Docker image will be created from the definition below. First, create a sub directory:

Install docker on raspberry pi 4 ubuntu mate and spotify

Now, using vi, nano or another editor, create a new file. Name the file “Dockerfile” and make its contents as below:

Save the file.


Build the Image

Install Docker On Raspberry Pi 4 Ubuntu Iso

Build the image as follows:

(Note. If the command failed with errors like “Err:1 focal InRelease. At least one invalid signature was encountered.”, it’s likely due to a known bug in libseccom2. For a fix, see the Appendix)

This command will perform many tasks. The standard base image “ubuntu” is pulled (downloaded) from Docker Hub. Several libraries and tools are installed into it. Next, the comskip source code is obtained (cloned) from Github. Lastly, comskip is compiled. The whole process took about 16 minutes on a Pi2, so be patient.

Note the last four lines of the Docker file are commented out and don’t do anything for the moment. More on that later.

Run the Docker Container

We have freshly built Docker image, containing all of the bits and pieces needed to run comskip. Although many items of software have been installed, eg. ffmpeg and git, these have not been installed onto your Pi. Instead, they have been installed into the Docker image. All that has been installed on the Pi is Docker itself.

In order to bring that image to life, run a container. Run a container based on the image as follows.

The container is running and you are left with a prompt. This is a container shell and commands issued here are executed in the container, not directly on the host (your Pi).

Run Comskip

The command we want to run is comskip. For demonstration, I have uploaded a video file into the container.

Success! The video file, a 50 minute episode of Minder, was processed in 667 seconds, about 11 minutes.

Access to Video Files

Comskip can be used to process TV recordings created by apps like OSMC and Kodi. If you have a media center PC or similar, its recordings folder could be mounted into the Docker container. If you have shared out the recordings directory, eg. by configuring Samba on an OSMC server, then the last 4 lines of the Docker file can be used to mount the share.

To try it, uncomment the last 4 lines in the Docker file. And edit the last line, replacing <osmc IP address> with your media centre’s IP. Re-run the docker build and docker run commands. Then, at the container prompt, mount the share:

Exit the Container


When you are finished messing around in the Docker container, type exit or press ctrl-d.

Raspberry Pi 4 Specs


Install Docker On Raspberry Pi 4 Ubuntu Windows 10

You are returned to the Pi command prompt. To run the container again, just repeat the docker run command above. Incidentally, the “–cap add” flags in that command are needed only so that the mount command works within the container.


Docker has different benefits in different situations. Here, it enabled us to install a software package on our system, and its fairly complicated set of dependencies, without splattering new libraries and modules all over the system. ffmpeg, libtool and other items named in the Dockerfile (under ENV PACKAGES) were installed within the Docker image, not into the Pi’s system folders. Out host system thus remains “clean” and unchanged.

When the Docker container exits, any files we created on the fly are lost, including files created by comskip. Storage is ephemeral. One solution is to use Docker storage volumes. Another is to mount a remote data area directly into the container, which is what we did.


libseccomp2 Bug (December 2020)

If the docker build resulted in errors like “Err:1 focal InRelease. At least one invalid signature was encountered.“, it will most likely be due to a known bug in libseccom2. The bug has been fixed but the fix has not yet made its way into the stable Debian repositories. If you get this error, you can forcibly update libseccomp2 from the unstable repos. (at your own risk – they are called “unstable”, after all. I recommend proceeding only on a system that can be rebuilt and isn’t performing a critical function for you).

Check your current version of libseccomp2. I encountered the error with version 2.3.3-4:

Download the latest version from the Debian Sid. You will need to choose the right architecture for your device and also check your installed libc version is high enough (compare the output of “dpkg -l libc6” on your system with the libc notes on the aforementioned page). I am using a Raspberry Pi 4, so the architecture is “armf” (as it is for the Pi 2 and Pi 3). I downloaded libseccomp2 version 5.2.0-3 from the armf page, using “wget” and choosing a mirror located here in the UK. Alternatively, you could download with a browser.

Note this URL is likely to change and might no longer work when you are reading this.

Install the package:

Install Docker On Raspberry Pi 4 Ubuntu Mate And Spotify

Check the new version:

If you return to the main procedure, the docker build command should now work

Thanks to Igor Velkov for posting this solution on AskUbuntu.