• Contact
  • About Me
  • Privacy Policy
DefenceDev
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
No Result
View All Result
DefenceDev
No Result
View All Result
ADVERTISEMENT
Home Solutions Docker

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

by neo
June 8, 2025
in Docker
0
Install Docker on Raspberry Pi 4 with Ubuntu 22.04

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

0
SHARES
3
VIEWS
Share on FacebookShare on Twitter
ADVERTISEMENT

Docker on Raspberry Pi4

Installing Docker on Raspberry Pi is a great way to turn your Pi into a lightweight container server.

Running Docker on a Raspberry Pi 4 turns your tiny board into a powerful containerized platform. Whether you’re hosting a personal project, testing microservices, or automating your home network, Docker makes deployment easy and repeatable. In this guide, I’ll show you how I installed Docker on Ubuntu 22.04 running on my Raspberry Pi 4, and I’ll share the essential commands I use to manage containers daily.

Prerequisites

  • Raspberry Pi 4 with Ubuntu 22.04 (64-bit) installed
  • Internet access
  • User with sudo privileges
  • SSH access

Step-by-Step: Install Docker on Raspberry Pi 4

1. Update the system

sudo apt update && sudo apt upgrade -y

2. Install Docker on Raspberry Pi using the Official Repository

# Installs essential packages:
# - ca-certificates: enables secure HTTPS connections
# - curl: tool for transferring data from URLs (used to download files)
# - gnupg: provides encryption and signing tools (needed for verifying downloaded packages)

sudo apt install -y ca-certificates curl gnupg

# Add GPG Key
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
  sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

# Add Docker Repository for Ubuntu
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
  https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

3. Check Docker Installation

docker --version
docker compose version

Output of the commands:

ADVERTISEMENT
root@pi4:~# docker version
Client: Docker Engine - Community
 Version:           28.2.2
 API version:       1.50
 Go version:        go1.24.3
 Git commit:        e6534b4
 Built:             Fri May 30 12:07:29 2025
 OS/Arch:           linux/arm64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          28.2.2
  API version:      1.50 (minimum version 1.24)
  Go version:       go1.24.3
  Git commit:       45873be
  Built:            Fri May 30 12:07:29 2025
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.7.27
  GitCommit:        05044ec0a9a75232cad458027ca83437aae3f4da
 runc:
  Version:          1.2.5
  GitCommit:        v1.2.5-0-g59923ef
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

root@pi4:~# docker compose version
Docker Compose version v2.36.2

4. Start and Enable Docker Service

# Start the Docker service immediately
sudo systemctl start docker

# Enable the Docker service to start automatically at system boot
sudo systemctl enable docker

5. Run Docker Test Container to Verify Installation

After checking the Docker and Docker Compose versions, you can run a simple test container to verify that Docker is working correctly:

# Run Docker test container to verify everything works
sudo docker run hello-world

If everything is set up properly, you should see an output similar to this:

root@pi4:~# sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c9c5fd25a1bd: Pull complete
Digest: sha256:0b6a027b5cf322f09f6706c754e086a232ec1ddba835c8a15c6cb74ef0d43c29
Status: Downloaded newer image for hello-world:latest

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/

This confirms that your Docker engine is installed and functioning properly on your Raspberry Pi 4.

5. (Optional) Add Your User in The Docker Group

sudo usermod -aG docker $USER

Useful Docker Commands

Once Docker is installed, here are the commands I use most often to work with containers and images.

ommandWhat It Does
docker versionShow Docker version
docker infoShow system-wide Docker info
docker pull <image>Download a Docker image
docker imagesList all downloaded images
docker run -d --name <name> <image>Run a container in detached mode
docker psShow running containers
docker ps -aShow all containers (including stopped)
docker stop <container>Stop a running container
docker rm <container>Remove a container
docker rmi <image>Remove a Docker image
docker exec -it <container> bashAccess an interactive shell inside a running container
docker network lsList all Docker networks
nano docker-compose.yamlCreate or edit a docker-compose.yaml file
docker compose up -dStart all services defined in the Compose file in detached mode
docker compose down -vStop and remove services, including volumes
docker logs <container>View logs from a running container
docker exec -it <container> shAccess a shell inside a container (useful when Bash is not available)

Installing Docker on Raspberry Pi 4 with Ubuntu 22.04 is quick, and it unlocks powerful tools for automation, app hosting, and experimentation. With just a few commands, your Pi becomes a flexible server for anything from file sharing to web hosting.

ADVERTISEMENT
ADVERTISEMENT

In future articles, I’ll cover:

  • My favorite containers to run on Raspberry Pi
  • Using Docker Compose for persistent setups
  • Managing Docker with Portainer GUI

About The Author

neo

See author's posts

ADVERTISEMENT
Previous Post

MikroTik: Check Your Wireless Password

Next Post

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

neo

Next Post
Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Leave a Reply

Your email address will not be published. Required fields are marked *

Follow Us

  • Trending
  • Comments
  • Latest
MikroTik: Export Configuration in Text File

MikroTik: Export Configuration in Text File

Fortinet FortiGate: Static Route Configuration via GUI and CLI

Fortinet FortiGate: Static Route Configuration via GUI and CLI

Fortinet FortiGate Upgrade Path Tool

Fortinet FortiGate Upgrade Path Tool

Immich: Installation on Ubuntu 22.04

Immich: Installation on Ubuntu 22.04

NextCloud: Port Forwarding - Essential Ports for Smooth Functionality

NextCloud: Port Forwarding – Essential Ports for Smooth Functionality and Remote Access

Organizing and Managing Photos with Immich: Features I Use

Organizing and Managing Photos with Immich: Features I Use

Install Ubuntu 22.04 on Oracle VM Virtual Box

Install Ubuntu 22.04 on Oracle VM Virtual Box

Linux Directories: cd (Change Directory), pwd (Print Working Directory), mkdir (Make Directory)

Linux Directories: cd (Change Directory), pwd (Print Working Directory), mkdir (Make Directory)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

MikroTik: Check Your Wireless Password

MikroTik: Check Your Wireless Password

Install SoftEther VPN Server on Ubuntu 24.04

Install SoftEther VPN Server on Ubuntu 24.04

Recent News

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

MikroTik: Check Your Wireless Password

MikroTik: Check Your Wireless Password

Install SoftEther VPN Server on Ubuntu 24.04

Install SoftEther VPN Server on Ubuntu 24.04

Timeshift on Linux: How to Create and Restore System Snapshots

Timeshift on Linux: How to Create and Restore System Snapshots

ADVERTISEMENT

DefenceDev Tutorials

defencedev Logo

Whether you’re just starting or looking to expand your skills, I hope you find useful information and engaging discussions here. Let me take you through my journey and the goals behind this space!

Follow Us

Browse by Category

  • Blog
  • Cloud
    • Private
  • Linux Tutorials
    • Bash Scripting Tutorials
    • Commands
    • Networking
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Solutions
    • Docker
  • Video Tutorials
    • MikroTik Videos

Recent News

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

  • Site Map
  • Privacy Policy
  • Facebook Page
  • Disclaimer
  • Contact
  • About Me

© 2025 defencedev.com - All rights reserved.

No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos

© 2025 defencedev.com - All rights reserved.