Portainer

Install Portainer

  1. SSH into the server you wish to install Portainer on

  2. Copy paste the below commands to install Docker (assumes Ubuntu)

     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
    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
    sudo apt-get update
    sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin
  3. Run the below command to create your Portainer container

    docker run -d --label=com.centurylinklabs.watchtower.enable=true -p 8000:8000 -p 9443:9443 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer:/data portainer/portainer-ce:latest

    I would suggest installing Portainer using this command (rather than the one provided by Portainer themselves) as it adds a WatchTower label to enable auto-updates, which we will set up later in this doco

  4. Run the below command and confirm you see that the Portainer container is running

    docker up

Configure Portainer

Now that Portainer is installed, we can browse to the webUI and configure it

Account Creation

  1. Browse to https://YOURSERVERIP:9443

  2. Create your credentials

    1. Save them to your password vault

Create a stack to update Portainer

This will deploy a Watchtower container which will update any apps with the label com.centurylinklabs.watchtower.enable=true . This allows for automatic updates for the Portainer container

  1. Navigate to stacks

  2. Create a new stack and provide the below code

  3. Click on Deploy

Last updated

Was this helpful?