Raspberry Pi 4
Let's start
Chicken or the egg
SSH, set up your client
Static IP, WiFi, BT and IPv6
Updating & upgrading Raspbian
Hostname and SSH
What's my temperature?

Docker / Docker Compose


There is an infinite amount of information on the web about installing and configuring a Raspberry Pi 4 Model B. And this was exactly my problem to find the right information here. There are certainly many options that lead to the goal. This is just my way doing the configuartion.

Let's start

The Raspberry Pi (RPi) will later be operated without a display and keyboard. Therefore the Raspbian Buster Lite image is used. I used the version from 2019-09-26. After downloading the ZIP file, it can be transferred to the SD card with e.g. ApplePi-Baker v2 or balenaEtcher.

SSH will later be used to connect to the RPi. But SSH is turned off for security reasons. SSH can be enabled by placing a file named ssh, without any extension, onto the boot partition of the SD card [Source].

If balenaEtcher is used, the file ssh must be created in the root directory after creating the SD card. With ApplePi-Baker it is easier, here the option "Enable SSH" has to be selected additionally. After creating the sd card, insert it into the RPi and power the RPi. Unfortunately we have a problem now, chicken or the egg.

Chicken or the egg

After switching on, it may take about 30 seconds before we can access the RPi. But how we can connect to the RPi if we do not know the IP address? The RPi use DHCP for requesting an IP address. Perhaps you can get the DHCP info from your router if you are in a home network. Furthermore I found examples for nmap how to get the IP information. But I think that nmap is a very bad idea if you are in an enterprise network. Note: The Avahi daemon (mDNS) is started by default at the RPi and the default hostname is raspberrypi.

If you are using Linux or Mac OS X try to use the following command in a terminal:

  • ping raspberrypi.local

In case of Windows try to use the following commands in a dos box:

  • ping raspberrypi.local
  • ping raspberrypi.
  • ping raspberrypi

Yes, there is a dot at the end of the line for the second ping. Hopefully you have now the IP address of your RPi. We can now use this address to connect to the RPi by SSH.

SSH, set up your client

Here I make it easy for myself with the description. Please take a look in the original Raspberry Pi documentation under SSH, point 4.

Btw, the default user is pi and the default password is raspberry. Assuming you are using Windows with PuTTY, the first connections will look like:

The first thing to do is change the password with the following command:

  • passwd

Next I will set a static IP address, and disable WiFi, Bluetooth and IPv6.

Static IP, WiFi, BT and IPv6

How to configure a static IP address can be find here. In general some changes must be done in /etc/dhcpcd.conf. Here I will use nano for the editor. Therefor the following command is used:

  • sudo nano /etc/dhcpcd.conf

The next lines are just an example. They need to be changed according to your infrastructure:

interface eth0
static ip_address=
static routers=
static domain_name_servers=

Next WiFi and Bluetooth will be disabled. Therefore some lines must be added to the /boot/config.txt. Here the following command is used:

  • sudo nano /boot/config.txt

The following lines must be added [Source]:


And for disabling IPv6 the content of /etc/modprobe.d/ipv6.conf must be changed. Therefore type:

  • sudo nano /etc/modprobe.d/ipv6.conf

And add the following lines [Source]:

alias net-pf-10 off
alias ipv6 off
options ipv6 disable_ipv6=1
blacklist ipv6

After these changes make a reboot with:

  • sudo reboot

After the reboot, PuTTY will lose the connection. Be in mind that you must use your new IP address for the next PuTTY session.

Updating & upgrading Raspbian

This is easy again. Please take a look in the original Raspberry Pi documentation. Open a new PuTTY session and type:

  • sudo apt update
  • sudo apt -y full-upgrade

This can take a while. But at the end the software is up to date.

Hostname and SSH

I want to change the hostname raspberrypi. But after changing the hostname, a new SSH key should be created too. For this procedure I found a description here. But unfortunately the hostname command does not work in my case. Therefore I changed the procedure a little bit. I want to use pi4 for the new hostname. The following commands are now required:

  • sudo raspi-config nonint do_hostname "pi4"
  • sudo reboot
  • sudo rm /etc/ssh/ssh_host_*
  • sudo dpkg-reconfigure openssh-server
  • sudo reboot

The next step is to change some settings like localisation with raspi-config.


raspi-config will be described by the original Raspberry Pi documentation here. But instead of using the GUI, you can change the settings from the command line too. I will change the Boot Options to B2, Localisation to Europe/Berlin, Memory Split to 16 and expand the filesystem. Therefore the following commands are needed:

  • sudo raspi-config nonint do_boot_behaviour B2
  • sudo timedatectl set-timezone Europe/Berlin
  • sudo raspi-config nonint do_memory_split 16
  • sudo raspi-config --expand-rootfs
  • sudo reboot

I found additional information on this on the following page. For security, I have put the overview of the raspi-config command line options here again.

What's my temperature?

Perhaps it is interesting to monitor the temperature of the RPi. A description of this can be found on the following page. But in short, use the following commands:

  • cd
  • nano my-pi-temp.sh

And copy the following lines:

# Script: my-pi-temp.sh
# Purpose: Display the ARM CPU and GPU temperature of Raspberry Pi 2/3
# Author: Vivek Gite www.cyberciti.biz under GPL v2.x+
# -------------------------------------------------------
echo "$(date) @ $(hostname)"
echo "-------------------------------------------"
echo "GPU => $(/opt/vc/bin/vcgencmd measure_temp)"
echo "CPU => $((cpu/1000))'C"

Now we must set the permission for the new file too:

  • chmod +x my-pi-temp.sh

And now we can use the new script with the following command:

  • ./my-pi-temp.sh


From time to time you should check for updates and upgrade your system like described here. In short, use the following commands:

  • sudo apt update
  • sudo apt full-upgrade
  • sudo apt clean

The official documentation for the Raspberry Pi can be find here.


Log2Ram can be used to extend the sd card lifetime of a Raspberry Pi. To avoid writing too many times log data, Log2Ram will be used. More information can be find here and here. To make it short again:

  • sudo apt-get install git
  • cd /home/pi
  • git clone https://github.com/azlux/log2ram.git
  • cd log2ram
  • chmod +x install.sh
  • sudo ./install.sh
  • sudo nano /etc/log2ram.conf
  • sudo reboot

Docker / Docker Compose

The real reason for my Raspberry Pi and why I have created the description for the Raspberry Pi here is that I would like to take a closer look at Docker. That is why there is also a description of how to install Docker on the RPi.

Note: As mentioned above I am using Raspbian Buster Lite version 2019-09-26 on a Raspberry Pi 4 Model 4 (4GB). For the installation of docker the following commands are needed:

  • cd /home/pi
  • curl -fsSL get.docker.com -o get-docker.sh
  • sh get-docker.sh
  • sudo usermod -aG docker pi
  • sudo reboot

To verify that Docker is installed and running type:

  • docker version
  • docker info

You should see now some information about versions and other things. Another test is the Docker hello-world:

  • docker run hello-world

If everything is installed correctly, the message "Hello from Docker!" should appear. If Docker has now been installed correctly, the "Docker Compose" tool can be installed. The following commands are used for this purpose:

  • sudo apt-get install -y python3-pip
  • sudo pip3 install docker-compose

To verify that Docker Compose is installed type:

  • docker-compose version

If you see some version information now, Docker and Docker Compose have been installed correctly.