Raspberry Pi 4 docker server — headless installation
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
Second create a new Text Document
Third name the new file as ssh without file, click on Yes on the warning message and unmount the card.
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
SSH terminal will open after 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 upgradesudo 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)’
Buster has version code 10 and we have to modify the dist_version from “buster” to “stretch”.
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