Updating Guide

Updating Portainer on Docker Standalone

This guide will walk you trough updating Portainer in terminal. Always match the agent version to the Portainer Server version. In other words, when you're installing or updating to Portainer 2.27.9 make sure all of the agents are also on version 2.27.9.

To update to the latest version of Portainer Server, use the following commands to stop then remove the old version. Your other applications/containers will not be removed.

Portainer Documentation

Updating Portainer
  1. SSH to main Portainer machine (Overseer)
  2. Run Following Commands
docker stop portainer
docker rm portainer
docker pull portainer/portainer-ce:lts
docker run -d -p 8000:8000 -p 9443:9443 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:lts

This will stop and remove old version and reinstalled new on. The newest version of Portainer will now be deployed on your system, using the persistent data from the previous version, and will also upgrade the Portainer database to the new version.

Updating Portainer Agent

  1. SSH to vms that run portainer agents (External vm, Internal vm)
  2. Run Following Commands
docker stop portainer_agent
docker rm portainer_agent
docker pull portainer/agent:lts
docker run -d -p 9001:9001 --name portainer_agent --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes portainer/agent:lts

Updating Authentik

This is extended guide to updating Authentik software. Read trough official Authentik documentation before running updates.

Authentik Documentation

  1. Take a snapshot of Overseer vm
  2. Navigate to Authentik Directory
cd /docker/authentik
  1. Backup Database
docker exec -t authentik_postgresql_1 pg_dumpall -c -U postgres > authentik_backup.sql
  1. Download the latest docker-compose.yml file
wget -O docker-compose.yml https://goauthentik.io/docker-compose.yml
  1. Ensure .env is all set and has following variables in it
touch .env
PG_PASS=your_database_password
PG_USER=authentik
PG_DB=authentik
AUTHENTIK_SECRET_KEY=your_secret_key
AUTHENTIK_TAG=latest
  1. Pull the Latest image and apply the updates
docker compose pull
docker compose up -d
  1. Check the status
docker compose ps
  1. Login to Authentik and make sure everything is up to date, and everything is working properly

Optional:

If there is an error due to space when downloading or installing the image run a clean up command: 

docker image prune -a

Update Docker Compose Tool

To update Docker Compose to new v2 version follow these steps:

  1. Add Docker GPG Key
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
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
sudo chmod a+r /etc/apt/keyrings/docker.gpg
  1. Add Docker Repository
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
  1. Install Docker Compose
sudo apt-get update
sudo apt-get install docker-compose-plugin

 

To check the version

docker compose version