Skip to content

A lightweight script that searches your Docker Compose files for a specific port and returns the associated service based on folder structure.

License

Notifications You must be signed in to change notification settings

jlar0che/FindPort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” FindPort

A simple, fast script that searches through your Docker infrastructure and tells you exactly which service is using a given port (based on folder structure).

Built for homelab admins with dozens (or hundreds) of self-hosted services, FindPort makes it easy to resolve mystery ports and maintain Docker hygiene.


Why I Built This

In my homelab, I run over 125 Docker containers using a standardized structure:
Each service has its own directory (e.g. /volume1/docker/immich/, /volume1/docker/uptime-kuma/, /volume1/docker/jellystat/) containing a docker-compose.yml file and all persistent data. This setup makes backups and versioning clean and simple.

However, when I forget to document a port assignment, I sometimes run into "mystery ports" during scans with PortNoteβ€”a great tool for visualizing port usage. That’s when I needed a way to answer the dreaded question:

β€œWait… what’s running on port 3333?”


πŸ“Έ Screenshot

Homepage Screenshot

See the writeup and video tour on my website:
https://jacques.home-lab.site


πŸ›  How It Works

FindPort scans a directory tree (like /volume1/docker) for docker-compose.yml files.
It searches for the given port number and, when found, returns the name of the parent directoryβ€”i.e. the service name.

Since I follow the convention of naming each directory after the service it runs, this script gives me the exact answer I need with zero guesswork.


πŸ“‚ Directory Structure Assumed

/docker
β”œβ”€β”€ immich/
β”‚   └── docker-compose.yml
β”œβ”€β”€ vikunja/
β”‚   └── docker-compose.yml
β”œβ”€β”€ jellystat/
β”‚   └── docker-compose.yml

Each directory holds: A single service A docker-compose.yml All persistent volumes/data

🧰 Usage

  1. Clone or download this repo.

  2. Give the script the appropriate permissions

    sudo chmod +x findport.sh

  3. Run the script and pass it an unknown port as your argument:

    ./findport.sh 3333


βœ… Requirements

Standard GNU tools:

  • grep
  • awk
  • find

NOTE: Tested on Linux (Debian/Ubuntu) and Synology DSM with Docker installed.


πŸ™Œ Thanks

Shoutout to PortNote for being a fantastic port documentation tool and the inspiration for this script.

About

A lightweight script that searches your Docker Compose files for a specific port and returns the associated service based on folder structure.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages