DB-유

Portainer for Managing Synology Containers

· synology, docker, portainer

The moment I started using Compose, DSM's Docker GUI began to annoy me. It can't show which containers belong to which stack, can't edit a container created outside the GUI, and its view of networks and volumes is thin. Portainer is a web UI that runs as a container, talks to the Docker socket, and shows everything the engine knows about.

This is how I run it next to the DSM Docker package, and what to watch for when both touch the same containers. You need Docker on an x86 Synology, SSH as an administrator, and a free port; I use 9000, the default.

Data folder

Portainer stores its users, settings and endpoint list in a small database. Give it a folder on the volume:

sudo -i
mkdir -p /volume1/docker/portainer/data

Start the container

The key point is mounting the Docker socket so Portainer can talk to the local engine:

docker run -d --name portainer \
  --restart unless-stopped \
  -p 9000:9000 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /volume1/docker/portainer/data:/data \
  portainer/portainer:1.15.5

If you would rather do it from the DSM GUI: download portainer/portainer in Registry, launch it, and in Advanced Settings → Volume click Add File (not Add Folder) and type /var/run/docker.sock for both the file and the mount path. The GUI file picker cannot browse outside the shared folders, but typing the path works. Map local port 9000 to container port 9000 and enable auto-restart.

Alternatively as a Compose file in /volume1/docker/portainer/docker-compose.yml:

version: '2'
services:
  portainer:
    image: portainer/portainer:1.15.5
    container_name: portainer
    restart: unless-stopped
    ports:
      - "9000:9000"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /volume1/docker/portainer/data:/data

First login

Open http://<nas-ip>:9000. The first screen asks you to create an admin user and password; do this right away, because until then anyone on the network who reaches the port can claim the admin account. On the next screen choose "Local" to manage the Docker environment via the mounted socket, and click Connect.

You land on the dashboard with counts of containers, images, volumes and networks. Everything the DSM GUI created is there, including the bridge network DSM uses by default and containers started by Compose.

What it does that DSM can't

  • Containers → select one → Duplicate/Edit lets you change ports, mounts and environment on any container, including those created over SSH. Portainer recreates the container with the new definition.
  • Containers → Console gives you a shell inside a running container from the browser, docker exec -it without SSH.
  • Stacks lets you paste a Compose file and deploy it. On the standalone (non-Swarm) engine this uses Compose file format 2, so keep version: '2'.
  • Images shows unused images so you can clean them up; the DSM GUI happily lets old tags accumulate.
  • Networks shows which container sits on which network, handy when you have created a user-defined network for a stack.

I only use DSM's GUI for viewing now. Editing the same container from both tools works technically, but the DSM GUI's export/import feature only understands containers it created, so once Portainer has recreated a container, treat Portainer or Compose as the owner.

Quick check

docker ps --filter name=portainer
docker logs portainer

The log should show Starting Portainer 1.15.5 on :9000. In the browser, Containers should list every container docker ps -a shows, with the same state. Stop a test container from Portainer and confirm the DSM Docker GUI reflects it after a refresh.

Put Portainer behind DSM's reverse proxy (Control Panel → Application Portal → Reverse Proxy) with HTTPS if you intend to use it from outside the LAN, and never forward port 9000 directly.

If it misbehaves

  • Portainer shows "Failure: Unable to connect to the Docker environment" after a DSM reboot: the socket mount is missing or the Docker package started after Portainer tried to connect. Check docker inspect portainer | grep docker.sock; restarting the container fixes the timing case.
  • The DSM GUI shows the Portainer container but "Edit" is greyed out or fails with "Failed to edit container": DSM cannot edit containers whose settings it did not create. Use Portainer or the command line for changes.
  • After a DSM Docker package update, the Portainer UI reports an API version mismatch: older Portainer builds are tied to an API range. Pull a newer portainer/portainer tag and recreate the container with the same /data mount; users and settings are kept.
  • Stack deployment fails with "unsupported Compose file version": remove version: '3' features and use format 2 on a non-Swarm engine.

Portainer doesn't replace the Compose files in /volume1/docker; those stay the source of truth. It replaces the clicking, and for logs, a quick console and image cleanup it's a far better window than the package's own UI.