Portracker is a self‑hosted, real‑time port monitoring and discovery tool designed to give you a live, accurate map of every service running across your systems. The project’s GitHub page makes its purpose very clear: it automatically discovers services, tracks their ports, and presents everything in a clean, modern UI
Portracker is an open‑source pePortracker continuously scans the host system and identifies:
It eliminates the need for spreadsheets or manual port tracking and helps prevent deployment failures caused by port conflicts.
sudo apt update && sudo apt upgrade -ycurl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh
sudo apt install docker-compose-pluginsudo usermod -aG docker $USERsudo systemctl enable dockersudo rebootdocker run hello-worldmkdir ~/docker mkdir ~/docker/portracker
On the server, in ~/docker/portracker create docker-compose.yml
services:
portracker:
image: mostafawahied/portracker:latest
container_name: portracker
restart: unless-stopped
pid: "host"
cap_add:
- SYS_PTRACE
- SYS_ADMIN
security_opt:
- apparmor:unconfined
volumes:
- ./portracker-data:/data
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- "4999:4999"
environment:
- DATABASE_PATH=/data/portracker.db
- PORT=4999
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:4999/api/health"]
interval: 30s
timeout: 10s
start_period: 30s
retries: 3
On each agent system, use this compse file:
services:
portracker:
image: mostafawahied/portracker:latest
container_name: portracker_agent
restart: unless-stopped
# Required to see processes on the host machine
pid: "host"
# Privileges needed for port detection
cap_add:
- SYS_PTRACE
- SYS_ADMIN
security_opt:
- apparmor:unconfined
volumes:
- ./portracker-data:/data
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- "4999:4999"
environment:
- DATABASE_PATH=/data/portracker.db
- PORT=4999
# Optional: Give this agent a nickname so it looks good in the peer list
# - NODE_NAME=Remote-Node-02
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:4999/api/health"]
interval: 30s
timeout: 10s
retries: 3
On the server and each agent, from within ~/docker/portracker run:
docker compose up
On the server, run:
docker logs portracker
On each agent run:
docker logs portracker-agent
Open your browser and go to "http://<YOUR_SERVER_IP_ADDRESS>:4999
You should see your server. Click on Add Server in the lower left hand corner. The Add New Server screen will open. Give it a name, type in the AGENT_IP_ADDRESS:4999 and click on Add Server. Repeat for each agent.
You will see the main server and each agent down the left hand side. Click on the one you want to use and its data will show up.
The most useful feature is Generate Port. This will give you a free port to use.
If you find my content useful, please consider supporting this page: