Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
5 views

Docker on Raspberry Pi

This document provides a guide on installing Docker and setting up a MariaDB container on a Raspberry Pi. It includes step-by-step instructions for installation, configuration, and running a test container. The guide also highlights the limitations of using Docker on ARM architecture and suggests that not all Docker images may be compatible.

Uploaded by

samspam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Docker on Raspberry Pi

This document provides a guide on installing Docker and setting up a MariaDB container on a Raspberry Pi. It includes step-by-step instructions for installation, configuration, and running a test container. The guide also highlights the limitations of using Docker on ARM architecture and suggests that not all Docker images may be compatible.

Uploaded by

samspam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

15/03/2025, 12:38 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

In this post, I will guide you on how to install Docker (https://www.docker.com)


and set up your first container on Raspberry Pi. Docker has revolutionised the way
we work with servers and the development environment. I remember creating a
video about setting up a local server based on the Vagrant
(https://www.vagrantup.com) and VirtualBox virtualisation. Today I’d say it’s
completely outdated, even I think Vagrant was a revolution on its own.
This tiny computer is probably not the first thing that comes into your mind when
you are thinking about Docker and containerisation. As Raspberry Pi is running on
ARM architecture not everything is straight forward as on a normal computer.
Fortunately, there are versions of everything built for it.

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:

sudo usermod -aG docker pi

or for any current user:

https://wojciechnowicki.com/2022/01/12/raspi-mysql 1/4
15/03/2025, 12:38 Docker on Raspberry Pi

sudo usermod -aG docker ${USER}

You can check it by running the command below:


groups ${USER}

For example, result as you can see docker is on the list


➜ ~ groups ${USER}
pi : pi adm dialout cdrom sudo audio video plugdev games users input netdev spi i2c gpi

Run test container


Now you can check if the installation was successful by running:
docker run hello-world

This is the result you should see on your screen

Installing Docker Compose


Docker-compose is a tool that allows us to define multiple containers in a single
configuration and run them together. It’s useful for local environments as you can
start everything you need with just a single command. First, we need to install
Python 3, so we can use PIP to install docker-compose

https://wojciechnowicki.com/2022/01/12/raspi-mysql 2/4
15/03/2025, 12:38 Docker on Raspberry Pi

sudo apt-get install libffi-dev libssl-dev


sudo apt install python3-dev
sudo apt-get install -y python3 python3-pip

Now we can install docker-compose using pip3


sudo pip3 install docker-compose

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"

Then all you need is to execute:


docker-compose up

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.

Category: Raspi (/blog/categories#raspi)


Tags: #raspberrypi (5) (/blog/tags#raspberrypi) #docker (1) (/blog/tags#docker)
#mysql (2) (/blog/tags#mysql) #server (1) (/blog/tags#server)

https://wojciechnowicki.com/2022/01/12/raspi-mysql 3/4
15/03/2025, 12:38 Docker on Raspberry Pi

What do you think?


0 Responses

Upvote Funny Love Surprised Angry Sad

0 Comments 
1 Login

G Start the discussion…

LOG IN WITH OR SIGN UP WITH DISQUS ?

Name

 Share Best Newest Oldest

Copyright © WojciechNowicki.com 2013-2025, credits (/credits)

https://wojciechnowicki.com/2022/01/12/raspi-mysql 4/4

You might also like