Skip to content

Docker setup

Install docker and docker-compose to start building your containers. Make sure to install the correct version depending on your OS.

Update and Upgrade

sudo apt-get update && sudo apt-get upgrade -y

Install Docker

sudo apt-get install \
  ca-certificates \
  curl \
  gnupg \
  lsb-release

Use the following command to set up the stable repository:

echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

This is for an rpi4

Install Docker Engine:

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Check if it was successfully installed

docker --version
docker compose --version

Configure docker to start up on boot on systemd

sudo systemctl enable docker.service
sudo systemctl enable containerd.service

Add permissions for the current user

sudo usermod -aG docker $USER

Check

groups $USER

Start a container using docker-compose

Navigate to project root directory which contains the docker-compose.yml file. It is recommended to start with Portainer, Followed By Database.

docker-compose up -d