Installing Raspberry Pi OS
This is an instruction to install Raspberry Pi OS for use with Docker. Keep in mind that things will change and steps in the instruction will no longer be correct anymore.
Prepare SD card
Raspberry PI offers software to easily burn the Raspberry PI OS on a SD card. I chose the headless Raspberry Pi OS Lite without desktop.
Create an empty file “ssh” in boot partition to be able to SSH into the headless OS after installation.
Create file “wpa_supplicant.conf” in boot to add WiFi. The example need to be adjusted with the right credentials.
country=NL
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="myssid"
psk="mypassword"
}
SETUP Raspberry Pi OS
Boot your Raspberry Pi.
Use SSH to login. I like KiTTY as client, an alternative for PuTTY. KiTTY is installed on the NAS with local configuration.
The default user is pi with password raspberry.
STEP 1: Change some settings:
$ sudo raspi-config
- 1. System Options – S3 Password: Change password ‘raspberry’ for the ‘pi’ user
- 1. System Options – S4 Hostname: Set name for this computer on a network
- 5. Localisation Options: L1 Locale: Configure language and regional settings. I prefer en-GB.UTF-8.
- 5. Localisation Options: L2 Timezone: Configure time zone. I prefer Europe/Amsterdam.
- 5. Localisation Options: L4 WLAN Country: Set legal wireless channels for your country. I already set NL Netherlands within wpa_supplicant.conf.
- 6 Advanced Options / A1 Expand Filesystem: Ensures that all of the SD card is available
Reboot the Pi and login again.
STEP 2: Update OS:
$ sudo apt update -y
$ sudo apt upgrade -y
Get a coffee.
STEP 3: Install packages:
Install GIT
With Raspberry OS Lite, install GIT:
$ sudo apt-get install git -y
Install Docker
$ curl -fsSL https://get.docker.com -o docker.sh $ sudo sh docker.sh $ sudo usermod -aG docker pi $ logout
and login again. After the new login the new group setting for user pi is active.
curl command line tool and library for transferring data with URLs -fsSL -f (HTTP) Fail silently (no output at all) on server errors, -s Silent or quiet mode, -S When used with -s, --silent, it makes curl show an error message if it fails, -L If the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option will make curl redo the request on the new place. -o Write output to instead of stdout. sh Execute shell script usermod modify a user account -aG -a Add the user to the supplementary group(s). Use only with the -G option. -G A list of supplementary groups which the user is also a member of.
Install Portainer
$ sudo docker run -d -p 8000:8000 -p 9443:9443 --name=portainer-ce --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
open browser https://x.x.x.x:9443/ and set the password.
sudo run as superuser
docker execute docker
run the command to start a container process that will run isolated in that it has its own file system, its own networking, and its own isolated process tree separate from the host.
-d Run container in background and print container ID
-p 8000:8000 Publish a container's port(s) to the host. Port 8000
is a TLS tunnel server used to create a secure tunnel between the edge agent and the Portainer instance.
-p 9443:9443 Publish a container's port(s) to the host. HTTPS is enabled by default on port 9443
--name=portainer-ce Assign a name to the container
--restart=always Restart policy to apply when a container exits
-v /var/run/docker.sock:/var/run/docker.sock Bind mount a volume, the Unix socket the Docker daemon listens on by default, and it can be used to communicate with the daemon from within a container.
-v portainer_data:/data Bind mount a volume, to Persist Portainer data.
portainer/portainer-ce:latest image