PruneMate on Ugreen NAS

PruneMate is a lightweight, webโ€‘based tool designed to automatically clean up unused Docker resources (images, containers, volumes, and networks) on a schedule, helping keep your environment lean and efficient

๐Ÿ” What PruneMate Does

๐Ÿš€ Docker Installation Steps

I have two NVME SSDs installed in my DXP2800, mirrored, that I use to hold apps and docker containers. It's configured as /volume2. All of my docker containers are run from /volume2/docker. I have a pair of mirrored HHDs configured as /volume1 that I use to hold all my data.

  1. In the Ugreen NAS app, open the App Center
  2. Search for "Docker"
  3. Install Docker

๐Ÿ“ Setup PruneMate

This guide will setup your Ugreen NAS to run as a PruneMate Hub and Agent. You will browse to the Hub and it will see all the agents you have configured.

mkdir /volume2/docker/prunemate

๐Ÿงพ Docker Compose File

In /volume2/docker/prunemate create docker-compose.yml

services:
  prunemate:
    image: anoniemerd/prunemate:latest
    container_name: prunemate
    ports:
      - 7878:8080
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /volume1/docker/prunemate/logs:/var/log:rw
      - /volume1/docker/prunemate/config:/config:rw
    environment:
       PRUNEMATE_TZ: America/New_York
       PRUNEMATE_TIME_24H: true # use false instead of true for 12-Hour format (AM/PM)
    restart: on-failure:5 

โ–ถ๏ธ Start PruneMate

From within /volume2/docker/prunemate run:

docker compose up -d

๐Ÿ“œ View Logs

View logs for the PruneMate server:

docker logs prunemate

๐ŸŒ Access Web Interface

Open your browser and go to http://<your-ugreen-NAS>:7878.

Add other Docker hosts

In the GUI, you'll see External Docker hosts. Click on that and add a host. The URL will be tcp://192.168.xx.xx:2375 (use the IP address of a host you have running Docker). Click on Add Host

Repeat for each additional host you want to add.

On that each host that you added, create a directory called ~/docker/docker-socket-proxy and create this docker-compose.yml file there:

docker-socket-proxy:
    image: tecnativa/docker-socket-proxy:latest
    container_name: docker-socket-proxy
    restart: unless-stopped
    privileged: true
    ports:
      - "2375:2375"   # expose proxy on port 2375
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
      # Enable or disable specific API sections
      # Set to 1 to allow, 0 to block
      CONTAINERS: 1
      IMAGES: 1
      NETWORKS: 1
      VOLUMES: 1
      INFO: 1
      PRUNE: 1
      POST: 1
      # Example: block exec and swarm APIs
      EXEC: 0
      SWARM: 0

Now, from within ~/docker/docker-socket-proxy run:

docker compose up -d

Check the logs:

docker logs docker-socket-proxy

Now, in the GUI, you can click on Preview & Run and you'll see a section for the local host and each additional host that you added.

If you find my content useful, please consider supporting this page:

โ˜• Buy Me a Coffee