Self-hosted TinyPNG-style image compressor in Docker (web UI, 100% local)

Hey folks,

I’ve been wrestling with image workflows lately and thought I’d share a small Docker-based setup I ended up using. It might be useful to anyone who deals with a lot of photos or web assets.

The problem I was trying to solve

My usual pain points:

  • Lots of phone photos in HEIC that I can’t easily use everywhere
  • Needing to shrink images for the web (blogs, docs, websites, etc.)
  • Liking services like TinyPNG, but not loving the idea of uploading personal photos to a third-party service
  • Not wanting to install extra tools or libraries on every machine I touch

So I put together a Docker image that exposes a simple web UI for image compression and conversion:

Self-hosted TinyPNG alternative to compress, convert, and resize images (HEIC, JPG, PNG, PSD, etc.). Runs 100% locally using Docker for privacy.

What the web UI does

The idea was to make it feel like TinyPNG, but running on my own machine or server.

The typical flow looks like this:

  1. Start the container
  2. Open the web UI in your browser
  3. Drag & drop a bunch of images
  4. Choose what you want to do:
    • convert (e.g. HEIC → JPG/PNG)
    • compress (tune quality)
    • resize (set max width/height)
  5. Download the result (e.g. as a zip)

All processing happens inside the container. You can run it on a laptop, a home server, or a NAS that supports Docker.

If you like visuals, this is where I’d normally insert a short GIF demo: drag & drop → choose options → download. (Haven’t attached one here, but recording a quick 3–5 second GIF works well to show it off.)

How I run it with Docker

For quick local use, I usually just do:

docker run -d \
  --name imgcompress \
  -p 3001:5000 \
  karimz1/imgcompress:latest web

Then I open:

http://localhost:3001

and use the web UI.

With Docker Compose, something like this:

services:
  imgcompress:
    image: karimz1/imgcompress:latest
    container_name: imgcompress
    restart: unless-stopped
    ports:
      - "3001:5000"   # HOST:CONTAINER
    environment:
      - DISABLE_LOGO=true   # optional, keeps the UI more minimal
    command: ["web"]        # start the web interface

Bring it up with:

docker compose up -d

Why I used Docker for this

Main reasons:

  • Privacy – all images stay on my machine or server
  • Portability – same setup on Linux, macOS, or anywhere Docker runs
  • No host clutter – no need to install image-processing libraries on the host
  • Batch-friendly – can handle multiple images at once without manual uploads

There’s also a CLI mode in the image for scripting and CI workflows, but for day-to-day use I mostly stick to the web UI because it’s simple and easy to share with less technical people (they just need a browser).


If you want to have a look or try it out, the project is open source here:

https://github.com/karimz1/imgcompress

I’d be happy to hear feedback from other Docker users: things you’d do differently, ideas to improve the setup, or other approaches you’re using for “TinyPNG-style but self-hosted in Docker.”

Welcome to the Docker community. Interesting project. I had to deal with HEIC files and sharing them as well, but I ended up just selecting the images, and choosing “Quick actions” in the context menu and then “Convert image” on macOS. It didn’t allow customizing the compression level though.

2 Likes

That’s really cool, I didn’t know that. I tried converting HEIC files to JPEG on Windows, and it was a bit complicated without installing third-party tools. It’s nice to know that on macOS you can do it right from the context menu. Thanks for the tip :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.