There are two ways: a stack (recommended, because the settings are written down in the file) and a single container form. If you change the settings of a container that is already running, Portainer has to re-create it; your data survives because it lives in the volume.
Option 1: a stack (recommended)
- In Portainer choose your environment (usually local), then Stacks → Add stack.
- Name:
netlens. Build method: Web editor. - Paste the whole compose file from the box above (or the contents of
docker-compose.simple.yml) into the editor.network_mode: hostand thecap_add:list are already in it; there is nothing else to tick. - Optional: under Environment variables add
TZwith your time zone (for exampleEurope/Brussels). Leave everything else as it is. - Press Deploy the stack, wait for it to turn green, and open
http://<this-device>:8080.
Already have a stack for your other containers? Open that stack, press Editor, paste only the netlens: service under services: (keep the indentation: netlens: lines up with your other services), add netlens-data: under volumes: at the bottom, and press Update the stack.
To update Netlens later: open the stack, press Editor and then Update the stack with Re-pull image and redeploy switched on.
Option 2: one container by hand (Containers → Add container)
Portainer spreads the settings over several tabs under Advanced container settings (below the Image field). The capabilities have their own tab, called Capabilities; it is not part of Runtime & Resources.
| Where in Portainer | What to set |
|---|---|
| Name | netlens |
| Image | ghcr.io/gatlarf/netlens:latest (no registry login needed; leave Always pull the image on) |
| Network ports configuration | leave empty: with the host network the page is on port 8080 of the device itself |
| Advanced container settings → Network tab → Network | host |
| Advanced container settings → Capabilities tab | a list of switches: turn NET_RAW and NET_ADMIN to On; leave all the others as they are |
| Advanced container settings → Volumes tab → map additional volume | container /data, volume a new volume (for example netlens-data), Writable |
| Advanced container settings → Restart policy tab | Unless stopped |
| Advanced container settings → Env tab (optional) | add environment variable: TZ = your time zone, for example Europe/Brussels |
| Advanced container settings → Runtime & Resources tab | leave Privileged mode off |
Then press Deploy the container and open http://<this-device>:8080. Do not add no-new-privileges under Security.
Already running without the capabilities? Capabilities cannot be changed on a running container. Open the container in Portainer, press Duplicate/Edit, set the Network and Capabilities tabs as in the table (keep the same volume at /data: all your data stays), and press Deploy the container; Portainer asks to replace the old one. With a stack, add the lines to the stack in the editor and press Update the stack.