Photo by Nathan Cima / Unsplash

How to install Portainer on synology / linux / vps

docker Aug 5, 2024

Portainer supports both Docker standalone installations and Docker Swarm clusters, making it a versatile tool for managing Docker environments.

Portainer Community Edition is a lightweight service delivery platform for containerized applications that can be used to manage Docker, Swarm, Kubernetes and ACI environments. It is designed to be as simple to deploy as it is to use.[1]

Screenshot 2024-08-05 170339.png


  1. https://github.com/portainer/portainer ↩︎

Version used in this documentation

There can be slight differences on installation processes if you are on different versions or hardware

Application Version
Debian 11
Synology DSM 7.2.1-69057 Update 4
Linux Docker 20.10.21
Synology Docker 20.10.23-1437
Docker Compose 1.29.2
Portainer 2.19.5

Prerequisites

How to install Docker on synology / linux / vps
Learn how to install Docker with a comprehensive guide. Step-by-step instructions, tips, and best practices for a seamless Docker setup.

Environments in the examples

Check these if you are not sure which environments you can safely change

Name Mapped Container
Container name portainer
Container image portainer/portainer-ce
Config directory mount /volume1/docker/portainer /data
Edge agent port 10002 8000
Https port 10001 9443
Http port 10000 9000

I use different mapped port with the container port only to showcase how to change port. You can definitely use the default container port instead of changing them.

How to install Portainer

This tutorial assume that you know the most basic of unix commands and server setup

On linux device

Prepare the directory and docker compose file

  1. Prepare config directory for Portainer

    sudo mkdir -p /volume1/docker/portainer
    
  2. Create docker-compose.yml file

    sudo nano /volume1/docker/portainer/docker-compose.yml
    
  3. Fill the file with these:

    Change every ${} to your values

    version: "3.3"
    services:
      portainer-ce:
        ports:
          - ${HTTP_PORT}:9000
          - ${HTTPS_PORT}:9443 # you can delete this entire line and portainer will still work
          - ${SSH_PORT_FOR_AGENT}:8000 # you can delete this entire line if you don't use portainer agent
        container_name: portainer
        restart: on-failure:5
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock
          - ${PORTAINER_DATA_PATH}:/data
        image: portainer/portainer-ce
    
  4. Save the file, after that go to where it is

    cd /volume1/docker/portainer
    
  5. Install Portainer using Docker Compose

    sudo docker-compose up
    
  6. If you have no reverse proxy setup for Portainer, you need to open up the port to access Portainer

    sudo ufw allow 10000
    

On Synology NAS

If you can SSH to your synology, then it's always better to use the linux device method above

Using Synology Docker Wizard

In my opinion, installing a container using Synology Container Manager is less recommended. You may want to try installing your first container using CLI instead as it is more versatile, and it will teach you to configure your containers better. Check how to do it below

Prepare the directory

  1. Create /volume1/docker/portainer directory.

The docker part is a shared directory, go to the Control Panel to create it then create portainer directory inside docker shared directory

Download Portainer image

  1. Open up Container Manager application, go to the Registry tab, then search for portainer
  2. Double click on the image named portainer/portainer-ce make sure the tag is latest then hit Select
  3. Go to the Image tab and wait a couple minutes for the image to download, when it is done the burger icon should be all blue

Deploy Portainer

  1. Double click the portainer/portainer-ce:latest, or right click then select Run

  2. Fill the Container Name i.e. portainer

  3. Make sure Enable auto-restart is checked then click Next

    I did not check Enable web portal via Web Station because I'm not using it. You can check it to open Portainer using Synology Web Station

  4. Under Port Settings, put your mapped port into each Local Port, i.e. 10002 to the left of 8000 and 10000 to the left of 9000, then click Next, you can delete unused ports

  5. Under Volume Settings, click + Add Folder then pick the directory you created before i.e. /docker/10000-portainer, then put /data to the right side

  6. Make sure Run this container after the wizard is finished is checked, then click Done

Using Synology CLI

In my opinion, installing Portainer using CLI is the best way to install it on Synology

  1. Open Control Panel then open the Task Scheduler

  2. Click Create then pick Scheduled Task then User-defined script

  3. Pick a task name i.e. Install Portainer, choose root as user, then make sure that Enabled checkbox is unticked

  4. Go to the Schedule tab, click on Run on the following date and pick Do not repeat in the lower dropdown list

  5. Go to the Task Settings tab then paste the following codes to the User-defined script box

    docker run -d \
      --name=portainer \ #<<< you can change that
      -p 10001:8000 \ #<<< you can change that
      -p 10000:9000 \ #<<< you can change that
      -v /var/run/docker.sock:/var/run/docker.sock \
      -v /volume1/docker/10000-portainer:/data \ #<<< you can change that
      --restart=unless-stopped \
      portainer/portainer-ce
    
  6. Save everything then right click the task and clik Run

  7. Wait a couple minutes for the container to install. If you do not receive an error email then portainer will show in Synology Container Manager's Container tab with green dot in the status column

How to open Portainer

  1. Open your web browser
  2. Go to http://your-device-ip:10000
    i.e. http://192.168.1.1:10000
  3. Fill in your account details

How to update Portainer

On linux device

  1. Stop Portainer

    sudo docker stop portainer
    
  2. Delete the old container

    sudo docker rm portainer
    
  3. Go to where you put docker-compose.yml

    cd /volume1/docker/portainer
    
  4. Run Docker Compose again

    sudo docker-compose up
    

On Synology NAS

If you used Synology Container Manager

  1. Open Container Manager application
  2. Go to the Container tab
  3. Right click on Portainer, pick Action then Stop
  4. Right click on Portainer again, pick Action then Delete
  5. Do all the steps here again

If you used Synology CLI

  1. Open Docker application
  2. Go to the Container tab
  3. Right click on Portainer, pick Action then Stop
  4. Right click on Portainer again, pick Action then Delete
  5. Do all the steps here again
Kubernetes and Docker Container Management Software
Portainer is your container management software to deploy, troubleshoot, and secure applications across cloud, datacenter, and Industrial IoT use cases.
GitHub - portainer/portainer: Making Docker and Kubernetes management easy.
Making Docker and Kubernetes management easy. Contribute to portainer/portainer development by creating an account on GitHub.

Tags