Raspberry Pi 4 docker server — headless installation

Andor Markus
3 min readAug 5, 2019

1. Install the base operating system on the device

Download the ‘Raspbian Buster with desktop’ image from Raspbian website

Suggested SD card size is 32gb because its is used only for the operating system. To store any data use external USB 3.0 storage of you choice, they are much faster.

Unzip the downloaded image and write to the SD card with Etcher

On the end of the flashing procedure the SD card is automatically ejected. Remove the SD card from the write and put back to remount the drive.

SSH is not enabled by default on Raspbian, you have to enable it manually.

First open the ‘boot’ drive

Select the ‘boot’ drive

Second create a new Text Document

Right click / New / Text Document

Third name the new file as ssh without file, click on Yes on the warning message and unmount the card.

Name as SSH without extension
Click Yes

2. Configure the base operating system

Insert the SD card into Raspberry connect Ethernet and power. After few minutes the installation will be ready and you can reach the device via SSH.
Open you favourite SSH client, in my case Solar-Putty and create a new connection.

IP: raspberrypi or raspberrypi.local

Accept server’s host key

Select Yes

SSH terminal will open after successful connection

Successful connection

Username: pi
Password: raspberry

As a first step change the password to a secure one

passwd

Update the operating system it will take a few minutes

sudo apt-get update
sudo apt-get upgrade
sudo reboot

3. Install Docker

What is docker: https://en.wikipedia.org/wiki/Docker_(software)

Currently docker does not support Debian Buster, we have to install as Debian Stretch.

mkdir Dowloads
cd Downloads
curl -sSL https://get.docker.com > get.docker.com
nano get.docker.com

In nano hit CTRL+W for search and looks for ‘debian|raspbian)’

Original settings

Buster has version code 10 and we have to modify the dist_version from “buster” to “stretch”.

Modified settings

Hit CTRL+O to save the setting and CTRL+X to exit nano

Run the modified version of Docker installation file

sudo sh get.docker.sh

Check successful installation

docker --version
Expected outcome

--

--

Andor Markus

Big Data Engineer. Open source advocate. Currently helping Marc O’Polo to build next generation cloud data platform.