Basic RPi Docker media server template with setup instructions.
Does not include instructions for setting up individual services, once running.
- Please submit an issue if you find any errors
- Be aware that you may need to use
docker compose
command instead ofdocker-compose
, based on your version
- Install OS onto a microSD using Raspberry Pi Imager
You can configure network and SSH access before installation. - SSH into the RPi
- Run
sudo raspi-config
to finish setting up your device
- Update RPi:
sudo apt update && sudo apt upgrade
- Run Docker setup:
curl -sSL https://get.docker.com | sh
Typically not recommended, but Docker is a trusted source. - Add user to the Docker group:
sudo usermod -aG docker [user]
Orsudo usermod -aG docker ${USER}
to add current user
You can check it by runninggroups ${USER}
.
Alternatively, usesudo
for everydocker
command. - Restart to apply changes:
sudo restart
- SSH to the RPi again
- Run a test container:
docker run hello-world
It should tell you whether your setup is running correctly. - Optionally enable Docker system service:
sudo systemctl enable docker
This allows containers to start on boot.
This is an optional step, but recommended.
- Install
pip3
:sudo apt-get install libffi-dev libssl-dev sudo apt install python3-dev sudo apt-get install -y python3 python3-pip
python3
&pip3
are required to setup and rundocker-compose
. - Update
pip
:pip install --upgrade pip
Usually not necessary - Install
docker-compose
:sudo pip3 install docker-compose
Check status usingdocker version
&docker-compose version
.
1See footnote if you getFailed to build bcrypt cryptography
.
I would recommend something like this:
Note that data
is within the docker
folder in this repo for simplicity.
Placing it outside of the docker
folder as shown below would be strongly recommended.
.
├── srv # Or /home/username/
│ ├── docker # Docker root
│ │ ├── appdata # Container local directory mounts
│ │ │ ├── container_name # Examples
│ │ │ ├── container_name-db
│ │ │ └── ...
│ │ ├── env
│ │ ├── secrets # Docker secrets
│ │ ├── shared # Shared certificates
│ │ ├── .env
│ │ └── docker-compose.yml
│ ├── data # Media root
│ │ ├── movies
│ │ ├── tv shows
│ │ └── ...
| └── ...
└── ...
- Setup Docker root
cd /srv sudo mkdir docker chown ${USER} docker cd docker
- Then either
- Clone this repo:
The
git clone --depth=1 --branch main https://github.com/filcuk/rpi-docker-starter.git .
.
at the end makes current folder the repo root folder, instead of creating a sub-directory. - Or set it up manually:
mkdir data appdata wget 'https://raw.githubusercontent.com/filcuk/rpi-docker-starter/main/.env' -O .env wget 'https://raw.githubusercontent.com/filcuk/rpi-docker-starter/main/docker-compose.yml' -O docker-compose.yml
- Clone this repo:
- Edit environment vars:
nano .env
You need to setDATADIR
,DOCKERDIR
,TZ
,PUID
&PGID
.
Useid
to get the user and docker group IDs.
cat
will read the contents of the file. - Spin up containers:
docker-compose up -d
- Check status:
docker-compose ps
- Access your services on:
192.168.1.x:[webui-port]
Note that in docker-compose, the first port is the one facing outwards.
I.e. for- 8800:8080
, you would enter192.168.1.x:8800
.
yacht
(included) lists services with their open ports as links for ease of access.
- See TRaSH Guides on help with setting up Sonarr & Radarr
- I would recommend setting up your own repo from the
docker
directory and submit changes to it regularly - You can use
docker system prune
to clear unused objects and reclaim storage
See docs.docker.com/compose for more.
- Discard any changes:
git restore .
You can discard changes for single file:git restore path/to/file
. - Pull latest:
git pull
- Install deb package:
sudo apt install docker-compose
Note that you may not have the latest version this way. - Downgrade
bcrypt
:sudo pip3 install -U "bcrypt<4.0.0"
Pre-v4bcrypt
should not have this issue. - See below
You can find more info about this issue here: github.com/adriankumpf
- Remove current binary (if present):
sudo apt remove docker-compose
orsudo rm /usr/local/bin/docker-compose
- Find the latest release: github.com/docker
- Download the binary:
sudo curl -L "https://github.com/docker/compose/releases/download/v2.14.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
- Allow execution:
sudo chmod +x /usr/local/bin/docker-compose
- Remove old link:
sudo rm /usr/bin/docker-compose
- Make new link:
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running?
Try sudo
your command. If that doesn't help, try sudo service docker restart
.
Run sudo apt remove needrestart
- it was installed by docker setup script and is not required.
Alternatively, just ignore the message.
pimylifeup.com
dev.to/elalemanyo
github.com/adriankumpf
github.com/kclyu
raspberrypi.stackexchange.com