Install docker on Raspbian Pi 4

Raspbian Version: Pi 4 OS System: Raspbian/buster (use lsb_release -cs to print) Verified Date: 2020/04/12

1. Uninstall old versions

$ sudo apt-get remove docker docker-engine docker.io containerd runc

2. Install Tool Chain

$ sudo apt-get update

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

3. Add GPG key

$ curl -fsSL https://download.docker.com/linux/raspbian/gpg | sudo apt-key add -

4. Add repository

$ sudo vim /etc/apt/sources.list.d/docker.list

Add this line and save:

# add docker repository
deb [arch=armhf] https://download.docker.com/linux/raspbian buster stable

5. Install via apt

 $ sudo apt-get update
 $ sudo apt-get install docker-ce docker-ce-cli containerd.io

Troubleshooting

You may encounter this error when apt install running:

Errors were encountered while processing:
 aufs-dkms

We can simply ignore it. Because aufs-dkms is not a dependency of docker-ce, but a recommendation.

Docker is not default to use aufs anymore; It now default prefer to use overlayfs2, which have been merged to the linux kernel mainline since 3.18.

[1] https://docs.docker.com/engine/install/debian/ [2] https://github.com/raspberrypi/linux/issues/3021#issuecomment-508704040