I have written about installing Docker and Docker Compose on Raspberry Pi OS in this article. But until now I could not install Mongo DB database on Raspberry Pi despite that there is docker image for ARM processors. The reason is that latest database versions does not support 32-bit ARM architecture. Raspberry Pi computer supports 64-bit instructions since version 3 release, but operation system Raspberry Pi OS (previously called Raspbian) is 32-bit system. To get real 64-bit computer you should install 64-bit Ubuntu or now there is opportunity to use Raspberry Pi 64-bit beta version.
Installing Raspbery Pi OS
For now it is beta version, so some features, programs are not available or may have bugs. We can expect that after some time it will be fully released. Usually using 64-bit version has more performance and also it can address more than 4 Gb of RAM. So I think in future ARM64 OS version will be used in most cases. Only Raspberry 2 and previous version does not support 64 bit instructions, so there is no choice what version to use. Also Raspberry Pi Zero has older processor without 64-bit instructions support.
Similar to 32-bit OS, you can download two versions of ARM64 operating system:
- Raspberry Pi OS ARM64 full version - full version includes desktop and recommended software. Can be used for desktop computer.
- Raspberry Pi OS ARM64 lite version - lite version does not include desktop and have minimum installed software. This version is ideal for computer that works as server.
For Mongo DB or other images for server the best choice is lite version. Download image and write it to SD card. I will not describe how to do it. There are instructions on raspberrypi.org
After writing image to SD card insert it into Raspberry Pi 3/4, connect it to monitor add keyboard and switch it on. First time load takes more time than it usually takes. After that using program raspi-config enable SSH connection, change name, set password, connect to WiFi (wired connection is recommended for server for more stability).
You may want to check if it is really 64-bit, not 32-bit version. It can be done with this command
hostnamectl
Result will be something like this
Static hostname: rpi-server64
Icon name: computer
Machine ID: 108e0507c0fb4667a9fd4378aaab455a
Boot ID: dca51c7aefe843e4820a60817e358214
Operating System: Debian GNU/Linux 10 (buster)
Kernel: Linux 5.4.51-v8+
Architecture: arm64
As you can see, architecture is arm64
To check particular application, can use this command to get installation path
which htop
Result
/usr/bin/htop
Then can check program
file /usr/bin/htop
Result
/usr/bin/htop: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=96abb7d508ec5511036f601725d6e5f259eff3ee, stripped
So now we are sure that we have installed 64-bit Raspberry Pi OS.
Install Docker
I did not invent the way how to install 64-bit Docker. I have found this article in the internet. In my article I will write only short description and commands.
- Install required packages
sudo apt update
sudo apt install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
2. Get docker signing key
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -
3. Add docker repositories
echo "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list
4. And finally install Docker
sudo apt update
sudo apt install -y --no-install-recommends \
docker-ce \
cgroupfs-mount
5. At last run these command to start docker and run it every time the system boots
sudo systemctl enable docker
sudo systemctl start docker
Unfortunately after installing Docker I could not run hello-world image because of some missing permissions. Adding permissions is described in my previous article about installing Docker, but I will write commands one more time.
- Create docker group if it is not already created.
sudo groupadd docker
2. Add current user to docker group. By default it will be pi user, but you can set also different user
sudo gpasswd -a $USER docker
3. Run command for the changes to take effect
newgrp docker
Now you can test Docker and run test image
docker run hello-world
Result should be something like that
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(arm64v8)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
Install Docker Compose
With docker compose you can easier to run multiple containers, save configuration in one yml file. Installation process is even simpler than that is used for Docker.
- Install required packages
sudo apt update
sudo apt install -y python3-pip libffi-dev
2. Install Docker Compose, this can take some time
sudo pip3 install docker-compose
Conclusion
Now we have installed Docker for 64-bit operating system and can use 64-bit images from Docker Hub. Images for arm64 are marked with arm64 or arm64/v8 tag. For example Mongo looks like this

So there is image not only for x86-64, but also for ARM64. 64-bit version of Raspberry Pi OS gives more opportunities, performance for running mini server on Raspberry Pi computer.