How to install Portainer on synology / linux / vps
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]
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
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
-
Prepare config directory for
Portainer
sudo mkdir -p /volume1/docker/portainer
-
Create
docker-compose.yml
filesudo nano /volume1/docker/portainer/docker-compose.yml
-
Fill the file with these:
Change every
${}
to your valuesversion: "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
-
Save the file, after that go to where it is
cd /volume1/docker/portainer
-
Install
Portainer
usingDocker Compose
sudo docker-compose up
-
If you have no reverse proxy setup for
Portainer
, you need to open up the port to accessPortainer
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
- Create
/volume1/docker/portainer
directory.
The
docker
part is a shared directory, go to theControl Panel
to create it then createportainer
directory insidedocker
shared directory
Download Portainer image
- Open up
Container Manager
application, go to theRegistry
tab, then search forportainer
- Double click on the image named
portainer/portainer-ce
make sure the tag islatest
then hitSelect
- 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
-
Double click the
portainer/portainer-ce:latest
, or right click then selectRun
-
Fill the
Container Name
i.e.portainer
-
Make sure
Enable auto-restart
is checked then clickNext
I did not check
Enable web portal via Web Station
because I'm not using it. You can check it to openPortainer
usingSynology Web Station
-
Under
Port Settings
, put your mapped port into eachLocal Port
, i.e.10002
to the left of8000
and10000
to the left of9000
, then clickNext
, you can delete unused ports -
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 -
Make sure
Run this container after the wizard is finished
is checked, then clickDone
Using Synology CLI
In my opinion, installing
Portainer
usingCLI
is the best way to install it on Synology
-
Open
Control Panel
then open theTask Scheduler
-
Click
Create
then pickScheduled Task
thenUser-defined script
-
Pick a task name i.e.
Install Portainer
, chooseroot
asuser
, then make sure thatEnabled
checkbox is unticked -
Go to the
Schedule
tab, click onRun on the following date
and pickDo not repeat
in the lower dropdown list -
Go to the
Task Settings
tab then paste the following codes to theUser-defined script
boxdocker 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
-
Save everything then right click the task and clik
Run
-
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'sContainer
tab with green dot in the status column
How to open Portainer
- Open your web browser
- Go to http://your-device-ip:10000
i.e. http://192.168.1.1:10000 - Fill in your account details
How to update Portainer
On linux device
-
Stop
Portainer
sudo docker stop portainer
-
Delete the old container
sudo docker rm portainer
-
Go to where you put
docker-compose.yml
cd /volume1/docker/portainer
-
Run
Docker Compose
againsudo docker-compose up
On Synology NAS
If you used Synology Container Manager
- Open
Container Manager
application - Go to the
Container
tab Right click
onPortainer
, pickAction
thenStop
Right click
onPortainer
again, pickAction
thenDelete
- Do all the steps here again
If you used Synology CLI
- Open
Docker
application - Go to the
Container
tab Right click
onPortainer
, pickAction
thenStop
Right click
onPortainer
again, pickAction
thenDelete
- Do all the steps here again