12/28/2021

Install Docker Raspbian

63

Estimated reading time: 11 minutes

  1. How To Install Docker Raspbian
  2. Install Docker On Ubuntu
  3. Install Docker Raspbian Lite
  4. Install Docker Raspbian Buster
  5. Install Docker Raspbian Jessie
  6. Install Pi Hole Docker Raspbian

Install Docker on Raspbian When I received my first Raspberry Pi 2, I thought: “maybe I can use it as a web server to host a few of my websites”. Trying different configurations and security options, I had to start all over a few times.

Oct 01, 2019 Docker-Compose. This is actually a Python script. Raspbian Buster is shipped with Python 3.6; so we just need to add PIP3 to install the python packages from pypy. Sudo apt-get install -y python3 python3-pip sudo pip3 install docker-compose. Wow, that was a struggle, lets check we are good. Docker-compose -version. Raspbian install not working - Docker-ce install fails. Closed swd120 opened this issue Aug 16, 2019 15 comments Closed Raspbian install not working - Docker. If you are running an older version of Raspbian, you can use our guide to upgrade to Buster. Docker for the Raspberry Pi has support for Raspbian Jessie, Stretch, and Buster. Installing Docker to the Raspberry Pi. Thanks to a nifty install script developed by the Docker team, installing the container software is incredibly simple.

To get started with Docker Engine on Debian, make sure youmeet the prerequisites, theninstall Docker.

Prerequisites

OS requirements

To install Docker Engine, you need the 64-bit version of one of these Debian orRaspbian versions:

  • Debian Bullseye 11 (stable)
  • Debian Buster 10 (oldstable)
  • Raspbian Bullseye 11 (stable)
  • Raspbian Buster 10 (oldstable)

Docker Engine is supported on x86_64 (or amd64), armhf, and arm64 architectures.

Uninstall old versions

Older versions of Docker were called docker, docker.io, or docker-engine.If these are installed, uninstall them:

It’s OK if apt-get reports that none of these packages are installed.

The contents of /var/lib/docker/, including images, containers, volumes, andnetworks, are preserved. The Docker Engine package is now called docker-ce.

Installation methods

You can install Docker Engine in different ways, depending on your needs:

  • Most usersset up Docker’s repositories and installfrom them, for ease of installation and upgrade tasks. This is therecommended approach, except for Raspbian.

  • Some users download the DEB package andinstall it manually and manageupgrades completely manually. This is useful in situations such as installingDocker on air-gapped systems with no access to the internet.

  • In testing and development environments, some users choose to use automatedconvenience scripts to install Docker.This is currently the only approach for Raspbian.

Install using the repository

Docker

Before you install Docker Engine for the first time on a new host machine, you needto set up the Docker repository. Afterward, you can install and update Dockerfrom the repository.

Raspbian users cannot use this method!

For Raspbian, installing using the repository is not yet supported. You mustinstead use the convenience script.

How To Install Docker Raspbian

Set up the repository

  1. Update the apt package index and install packages to allow apt to use arepository over HTTPS:

  2. Add Docker’s official GPG key:

  3. Use the following command to set up the stable repository. To add thenightly or test repository, add the word nightly or test (or both)after the word stable in the commands below. Learn about nightly and test channels.

    Note: The lsb_release -cs sub-command below returns the name of yourDebian distribution, such as helium. Sometimes, in a distributionlike BunsenLabs Linux, you might need to change $(lsb_release -cs)to your parent Debian distribution. For example, if you are using BunsenLabs Linux Helium, you could use stretch. Docker does not offer any guarantees on untestedand unsupported Debian distributions.

Install Docker Engine

This procedure works for Debian on x86_64 / amd64, armhf, arm64, and Raspbian.

  1. Update the apt package index, and install the latest version of DockerEngine and containerd, or go to the next step to install a specific version:

    Got multiple Docker repositories?

    If you have multiple Docker repositories enabled, installingor updating without specifying a version in the apt-get install orapt-get update command always installs the highest possible version,which may not be appropriate for your stability needs.

  2. To install a specific version of Docker Engine, list the available versionsin the repo, then select and install:

    a. List the versions available in your repo:

    b. Install a specific version using the version string from the second column, for example, 5:18.09.1~3-0~debian-stretch .

  3. Verify that Docker Engine is installed correctly by running the hello-worldimage.

    This command downloads a test image and runs it in a container. When thecontainer runs, it prints a message and exits.

Docker Engine is installed and running. The docker group is created but no usersare added to it. You need to use sudo to run Docker commands.Continue to Linux postinstall to allow non-privilegedusers to run Docker commands and for other optional configuration steps.

Upgrade Docker Engine

To upgrade Docker Engine, first run sudo apt-get update, then follow theinstallation instructions, choosing the newversion you want to install.

Install from a package

If you cannot use Docker’s repository to install Docker Engine, you can download the.deb file for your release and install it manually. You need to downloada new file each time you want to upgrade Docker.

  1. Go to https://download.docker.com/linux/debian/dists/,choose your Debian version, then browse to pool/stable/, choose amd64,armhf, or arm64, and download the .deb file for the Docker Engineversion you want to install.

    Note

    To install a nightly or test (pre-release) package,change the word stable in the above URL to nightly or test.Learn about nightly and test channels.

  2. Install Docker Engine, changing the path below to the path where you downloadedthe Docker package.

    The Docker daemon starts automatically.

  3. Verify that Docker Engine is installed correctly by running the hello-worldimage.

    This command downloads a test image and runs it in a container. When thecontainer runs, it prints a message and exits.

Docker Engine is installed and running. The docker group is created but no usersare added to it. You need to use sudo to run Docker commands.Continue to Post-installation steps for Linux to allownon-privileged users to run Docker commands and for other optional configurationsteps.

Upgrade Docker Engine

To upgrade Docker Engine, download the newer package file and repeat theinstallation procedure, pointing to the new file.

Install using the convenience script

Docker provides a convenience script at get.docker.comto install Docker into development environments quickly and non-interactively.The convenience script is not recommended for production environments, but can beused as an example to create a provisioning script that is tailored to your needs.Also refer to the install using the repositorysteps to learn about installation steps to install using the package repository.The source code for the script is open source, and can be found in thedocker-install repository on GitHub.

Always examine scripts downloaded from the internet before running them locally.Before installing, make yourself familiar with potential risks and limitationsof the convenience script:

Install

Install Docker On Ubuntu

  • The script requires root or sudo privileges to run.
  • The script attempts to detect your Linux distribution and version andconfigure your package management system for you, and does not allow you tocustomize most installation parameters.
  • The script installs dependencies and recommendations without asking forconfirmation. This may install a large number of packages, depending on thecurrent configuration of your host machine.
  • By default, the script installs the latest stable release of Docker, containerd,and runc. When using this script to provision a machine, this may result inunexpected major version upgrades of Docker. Always test (major) upgrades ina test environment before deploying to your production systems.
  • The script is not designed to upgrade an existing Docker installation. Whenusing the script to update an existing installation, dependencies may not beupdated to the expected version, causing outdated versions to be used.

Tip: preview script steps before running

You can run the script with the DRY_RUN=1 option to learn what steps thescript will execute during installation:

This example downloads the script from get.docker.comand runs it to install the latest stable release of Docker on Linux:

Docker is installed. The docker service starts automatically on Debian baseddistributions. On RPM based distributions, such as CentOS, Fedora, RHEL or SLES,you need to start it manually using the appropriate systemctl or service command.As the message indicates, non-root users cannot run Docker commands by default.

Use Docker as a non-privileged user, or install in rootless mode?

The installation script requires root or sudo privileges to install anduse Docker. If you want to grant non-root users access to Docker, refer to thepost-installation steps for Linux.Docker can also be installed without root privileges, or configured to runin rootless mode. For instructions on running Docker in rootless mode, refer torun the Docker daemon as a non-root user (rootless mode).

Install pre-releases

Docker also provides a convenience script at test.docker.comto install pre-releases of Docker on Linux. This script is equivalent to thescript at get.docker.com, but configures your package manager to enable the“test” channel from our package repository, which includes both stable andpre-releases (beta versions, release-candidates) of Docker. Use this script toget early access to new releases, and to evaluate them in a testing environmentbefore they are released as stable.

To install the latest version of Docker on Linux from the “test” channel, run:

Upgrade Docker after using the convenience script

If you installed Docker using the convenience script, you should upgrade Dockerusing your package manager directly. There is no advantage to re-running theconvenience script, and it can cause issues if it attempts to re-addrepositories which have already been added to the host machine.

Uninstall Docker Engine

  1. Uninstall the Docker Engine, CLI, and Containerd packages:

  2. Images, containers, volumes, or customized configuration files on your hostare not automatically removed. To delete all images, containers, andvolumes:

You must delete any edited configuration files manually.

Next steps

  • Continue to Post-installation steps for Linux.
  • Review the topics in Develop with Docker to learn how to build new applications using Docker.
requirements, apt, installation, debian, install, uninstall, upgrade, update

If you're reading this you're probably dealing with the hell I've just been through trying to get apps like Nextcloud, Redis and all sorts of other things in Docker to run on a Raspberry Pi4, which suddenly seemed to stop working overnight. The reason? These apps all use Alpine Linux as a common base image. However, Alpine made a move that caused some chaos for us. Their Alpine 3.13 variant is not compatible with Raspberry Pi 4 devices IF:

  • You are running a version of Docker prior to 19.04 (which is currently the case for stock Raspbian Repositories which has version 18 as the latest.
  • You are running an outdated libseccomp2 library.

Either one of, or both of these criteria will land you with incompatibilities and containers randomly crashing and refusing to start left/right/centre. The specifics for this issue are detailed (quite well to be fair) over at Alpine Linux's site - https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.13.0#time64_requirements

There are a few ways you can fix this issue, but all of them were hacky and janky in ways that didn't appeal to me - notably, reducing the enforcement capabilities of Docker by adjusting the seccomp profile. Alternatively you could try downgrading container versions (e.g. Nextcloud 21 back down to 20). The problem is that can lead to database versions detecting them as incompatible. Etc. etc.

So, the solution I've come up with is two-fold. Update libseccomp2 to the 'latest' version and run ahead of Raspbian Mainline. Then do the same for their version of Docker. See below, I'm running Docker 20.10 on Kernel 5.10 just fine. Confusingly, libseccomp2 is in Buster BACKports, but that version is AHEAD of Raspbian Mainline.

Install Docker Raspbian Lite

The steps for libseccomp2 are well documented, as this has been a problem on multiple platforms (not just RPI4). You could do a 'oneshot' installation of a newer version, which can be found here https://github.com/itzg/docker-minecraft-server/issues/755#issuecomment-781615497

Personally I feel the better method is to install it from the Buster Backports repo, which is very safe to add. It also means any future updates to libseccomp will be applied to the Pi.

The solution for Docker is something I came up with to skip ahead Raspbian Mainline's slow update cycle. We step forward and use Debian Bullseye unstable repositories, and pinch their lovely Docker Engine binaries which they've got cached upstream for the Beta Testers. Note their are confusing names again. Buster is the current version of Debian, with Bullseye being the next iteration 'upstream'. Why choose two names beginning with B...?

Here's how to do it...

Docker

First, we add Debian Bullseye as a repository which Raspbian can poll for software updates. We do this by creating the file /etc/apt/sources.list.d/bullseye-testing-docker.list and filling it with the contents below:

Then you ALSO NEED to put an Apt Preferences file into place, so that this new repository does not totally 'override' the normal Raspbian Buster one. Do not run apt-get upgrade just yet, or you'll magically transform your Pi into a Debian ARM build.

Install Docker Raspbian Buster

Create the Apt Preferences file /etc/apt/preferences.d/bullseye-docker.pref and populate it:

This file's meaning translates to 'Any packages found in this repository, set their priority to be lower than the default Raspbian Buster ones' (which have a priority of 500).

Now, we install Docker.io from Bullseye Upstream. Make sure to stop Docker first to avoid any potential nastiness (systemctl stop docker).

Install Docker Raspbian Jessie

apt install docker.io/bullseye

Voila! You have Docker 20+, and an up to date LibSecComp. Restart the Docker Daemon and have fun.

Install Pi Hole Docker Raspbian

You may be thinking - why not just install Docker from their website with the awful curl/bash script? This is because the script overwrites any custom config you have for Docker set up, and I have a lot. This was the most viable method for me in the end.

  • Most Viewed News

    • Install Docker Machine On Mac
    • Mac App Store Refund
    • Hp Utility Mac Install