Upgrading Portainer From The Command Line

This tutorial assumes you have a docker-compose file (docker-compose.yml) for portainer somewhere in your system.

docker stop portainer
docker rm portainer
docker pull portainer/portainer-ce:latest
cd /<where your docker-compose.yml file is located>
docker-compose up -d

Here's an example of Portainer docker-compose.yml file:

services:
  portainer:
    image: portainer/portainer-ce:latest
    container_name: portainer
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /home/jotdown/appdata/portainer:/data
    ports:
      - 9000:9000
      - 8000:8000
      - 9443:9443

Using Docker-Compose Command

Perhaps the better way to do this is if you have docker-compose installed in your system, just cd to where your docker-compose.yml file is and run these commands:

sudo docker-compose down
sudo docker-compose pull
sudo docker-compose up -d

note/upgrading-portainer-from-the-command-line.txt · Last modified: 11/10/22 3:27 pm by Jotter