Docker on Raspberry Pi
Docker on Raspberry Pi
Docker on Raspberry Pi
Building DB server using Docker on Raspberry Pi
Posted by wojtek on January 12, 2022 in Raspi
Installing Docker
First of all, we need to install Docker itself. It’s pretty simple to download and
install it on your Raspberry Pi. Please follow the steps below. We are not doing it
through apt so we don’t need to update the package list for the moment.
Please run the commands below:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
Next, you need to change permission for your user and add yourself to the
docker group. Here is a command for a standard Raspberry Pi OS user:
https://wojciechnowicki.com/2022/01/12/raspi-mysql 1/4
15/03/2025, 12:38 Docker on Raspberry Pi
https://wojciechnowicki.com/2022/01/12/raspi-mysql 2/4
15/03/2025, 12:38 Docker on Raspberry Pi
DB Container
Now it’s time to build our first functional container. I’ve chosen something useful
MariaDB database. I’d suggest creating a folder first to keep things tidy.
Create a docker-compose.yml file and paste this content:
version: '3.1'
services:
db:
image: yobasystems/alpine-mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: test
ports:
- "3306:3306"
If you don’t have any firewall configured on your Raspi, by default there is none.
You can access your database from your local network.
host: is yours Raspi IP
user: root
password: secret
port: 3306
This is just one example of what you can do using Docker on Raspberry Pi.
Unfortunately as Pi has ARM architecture, not all Docker images will work on it.
But usually is a case of googling the right one. Maybe one day we will try with
Docker Swarm and Raspberry Pi.
https://wojciechnowicki.com/2022/01/12/raspi-mysql 3/4
15/03/2025, 12:38 Docker on Raspberry Pi
0 Comments
1 Login
Name
https://wojciechnowicki.com/2022/01/12/raspi-mysql 4/4