My installation of a Raspberry Pi 3 Model B+ with fixed ip / bluetooth disabled and Docker

Introduction

It always seemed to me very nice to get started with a Raspberry Pi. For a few reasons: the idea is just great, you hear a lot about the Raspberry Pi, and it seemed to me it is very well suited for some software which is currently running 24-hours a day on my 450 watt Ubuntu server. Thus saving energy!

In the end I bought a Raspberry Pi 3 Model B + Starter Pack so that I immediately had a casing, power supply and 16GB Micro SD Card with Raspbian pre-installed.
I read that some people did have problems with the temperature of the Raspberry Pi, but for me it works fine (a steady 45° to 48° with spikes up to 66° when running heavy Node-Red flows).
The software I want to install is, among other things, Pi-hole, Node-Red and HA Bridge (also see my blog post about HA Bridge!).
And to challenge myself, I wanted to run all software via Docker (containers). Docker had been on my wish list for a while and this was the chance to try it out!
The use of Docker containers seems to me very useful. A good example is the Node-Red container: it is bundled with the recommended node.js version. So software conflicts between versions/dependencies (for example with node.js) should be in the past with Docker!

The installation of the Pi-hole, Node-Red and HA Bridge Docker containers will be separate blog entries at a later date.
So first this blog entry with a step-by-step description of how I installed my Raspberry Pi with Docker!

–rknl


Related software & hardware

Raspberry Pi

The Raspberry Pi is a affordable credit card–sized computer that plugs into your TV or display, and a keyboard and mouse. You can use it to learn coding and to build electronics projects, and for many of the things that your desktop PC does, like spreadsheets, word processing, browsing the internet, and playing games. It also plays high-definition video – More information


Docker

Docker is a modern platform for all applications and creates simple tooling and a universal packaging approach that bundles up all application dependencies inside a container. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings. Docker Engine enables containerized applications to run anywhere consistently on any infrastructure, solving “dependency hell” for developers and operations teams, and eliminating the “it works on my laptop!” problem – More information


Step 1: Boot up the Raspberry Pi

As mentioned in the introduction: I bought the
Raspberry Pi 3 Model B + Starter Pack and after assembling I connected it to a monitor, keyboard, mouse and network cable (but you can also use Wi-Fi).
After powering on the Raspberry Pi will start the desktop. The default user is “pi” and the default password is “raspberry”.

The first thing I did was going to “Start > Preferences > Add/Remove Software” to
remove some software I personally would not use:

  • BlueJ
  • Geany
  • Greenfoot
  • Scratch
  • Thonny
  • Sonic
  • LibreOffice
  • Claws
  • Minecraft
  • Node-Red

Note: It is great to see Node-Red is installed by default! But I did remove Node-Red because I wanted to install the Docker version of Node-Red

Then I did go to “Start > Preferences > Raspberry Pi Configuration” and made the following settings:

  • System: Start with CLI (and not the desktop)
  • System: Change the password of the pi user
  • Interfaces: Enable SSH
  • Localisation: Set timezone (for me Europe/Amsterdam)
  • Localisation: Set Keyboard (for me United States with English US with euro on 5)

Save your settings and reboot the Raspberry Pi!


Step 2: Assign a static ip address

Login to the CLI with the pi user and your new password. Now we will assign a static ip address to the Raspberry Pi. This is necessary when using Pi-hole, among other things.
Start by opening the DHCP client daemon configuration:

sudo nano /etc/dhcpcd.conf

Scroll down and add the following, replace <IP> with the new IP address of your Raspberry Pi and replace <ROUTER IP> with the IP address of your (internet) router:

interface eth0

static ip_address=<IP>/24
static routers=<ROUTER IP>
static domain_name_servers=<ROUTER IP>

interface wlan0

static ip_address=<IP>/24
static routers=<ROUTER IP>
static domain_name_servers=<ROUTER IP>

Save and close Nano. Now reboot the Raspberry Pi:

sudo reboot

After rebooting you can check the new setting with:

ip a

The new IP address must be assigned to “eth0:” or “wlan0”!


Step 3: Disable bluetooth

I did not need bluetooth, so I disabled it as following. First make sure bluetooth will not start anymore after rebooting, open the bluetooth configuration:

sudo nano /etc/bluetooth/main.conf

Change “AutoEnable” to false, so it looks like this:

AutoEnable=false

Save and close Nano. I also disabled the bluetooth service:

sudo systemctl disable bluetooth.service

Note: you can view the current status of the bluetooth service with the command “sudo systemctl status bluetooth.service”


Step 4: Automatically reboot the Raspberry Pi once a week

This step is very optional 🙂 Rebooting the Raspberry Pi once a week (at night) or more often, is in my opinion good practice. Just to “keep the speed” into the Raspberry Pi!

I am using the system crontab, open the crontab like this:

sudo crontab -e

Go to the bottom and add the following:

0 1 * * 6 /sbin/reboot

Save and exit the crontab. With this setting the Raspberry Pi will be rebooted every Saturday morning at 1:00.

Note: you can replace “0 1 * * 6” with your own entries:
– First entry: Minute when the process will be started [0-60]
– Second entry: Hour when the process will be started [0-23]
– Third entry: Day of the month when the process will be started [1-28/29/30/31]
– Fourth entry: Month of the year when the process will be started [1-12]
– Fifth entry: Weekday when the process will be started [0-6] [0 is Sunday]


Step 5: Install Docker CE (Community Edition)

And finally the last step, installing Docker. First go to your home directory:

cd ~

Download and execute the convenience script:

sudo apt-get update
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

I would like to use Docker as a non-root user and did run the following commands:

sudo groupadd docker
sudo usermod -aG docker pi

Then run the following command to start Docker automatically after rebooting:

sudo systemctl enable docker

And test the Docker installation with:

sudo docker run hello-world

With these steps I have laid the foundation for the further use of the Raspberry Pi with Docker! For me the next steps are:

  • Installing Pi-hole with Docker
  • Installing Unbound with Docker
  • Installing Node-Red with Docker
  • Installing HA Bridge with Docker

Are you interested? Just keep checking my blog! 😉

Tags and version information