An open source, self-hosted, real-time port monitoring and discovery tool.
JavaScript
2,472
91 commits
updated Oct 8, 2026
A self-hosted, real-time port monitoring and discovery tool.
By auto-discovering services on your systems, portracker provides a live, accurate map of your network. It helps eliminate manual tracking in spreadsheets and prevents deployment failures caused by port conflicts.
portracker instances as peers to view all your servers, containers, and VMs from a single dashboard.portracker instance under its physical host.portracker to discover running VMs* and gather enhanced system information like the OS version and uptime.*Note: VMs discovered on TrueNAS with the optional API key are shown in read-only mode. To enable full monitoring, deploy a portracker instance on each VM and add it as a separate server.
Deployment is designed to be simple using Docker.
Using Docker Compose:
Create a docker-compose.yml file:
services:
portracker:
image: mostafawahied/portracker:latest
container_name: portracker
restart: unless-stopped
pid: "host" # Required for port detection
# Required permissions for system ports service namespace access
cap_add:
- SYS_PTRACE # Linux hosts: read other PIDs' /proc entries
- SYS_ADMIN # Docker Desktop: allow namespace access for host ports (required for MacOS)
security_opt:
- apparmor:unconfined # Required for system ports
volumes:
# Required for data persistence
- ./portracker-data:/data
# Required for discovering services running in Docker
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- "4999:4999"
# environment:
# Optional: For enhanced TrueNAS features
# - TRUENAS_API_KEY=your-api-key-here
Then, run the application:
docker-compose up -d
Using Docker Run:
docker run -d \
--name portracker \
--restart unless-stopped \
--pid host \
--cap-add SYS_PTRACE \
--cap-add SYS_ADMIN \
--security-opt apparmor=unconfined \
-p 4999:4999 \
-v ./portracker-data:/data \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
mostafawahied/portracker:latest
For enhanced security, you can run portracker without direct access to the Docker socket by using a proxy. This restricts the Docker API permissions to read-only operations.
Using Docker Compose:
services:
docker-proxy:
image: tecnativa/docker-socket-proxy:latest
container_name: portracker-docker-proxy
restart: unless-stopped
environment:
- CONTAINERS=1
- IMAGES=1
- INFO=1
- NETWORKS=1
- POST=0
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- "2375:2375"
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
ports:
- "4999:4999"
environment:
- DOCKER_HOST=tcp://docker-proxy:2375
depends_on:
- docker-proxy
Using Docker Run:
# Start the Docker proxy
docker run -d \
--name portracker-docker-proxy \
--restart unless-stopped \
-p 2375:2375 \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-e CONTAINERS=1 \
-e IMAGES=1 \
-e INFO=1 \
-e NETWORKS=1 \
-e POST=0 \
tecnativa/docker-socket-proxy:latest
# Start portracker
docker run -d \
--name portracker \
--restart unless-stopped \
--pid host \
--cap-add SYS_PTRACE \
--cap-add SYS_ADMIN \
--security-opt apparmor=unconfined \
-p 4999:4999 \
-v ./portracker-data:/data \
-e DOCKER_HOST=tcp://localhost:2375 \
mostafawahied/portracker:latest
Configure portracker using environment variables.
| Variable | Description | Default |
|---|---|---|
PORT* | The port the web application will run on. | 4999 |
DATABASE_PATH* | Path inside the container to the SQLite database file. | /data/portracker.db |
TRUENAS_API_KEY | Optional API key for enhanced TrueNAS data collection. | |
ENABLE_AUTH | Set to true to enable authentication (v1.2.0+). | false |
SESSION_SECRET | Only needed with auth enabled. Prevents logout on container restart. | random |
CORS_ORIGIN | Comma-separated browser origins for a separately hosted frontend or a reverse proxy that rewrites Host. Same-origin access needs no setting. | disabled |
CACHE_TIMEOUT_MS | Duration in milliseconds to cache scan results. | 60000 |
DISABLE_CACHE | Set to true to disable all caching. | false |
INCLUDE_UDP | Set to true to include UDP ports in scans. | false |
MAX_INTERNAL_PORTS_PER_CONTAINER | Maximum unpublished internal ports listed for one container. Containers above the limit keep published ports but omit internal rows. | 100 |
DEBUG | Set to true for verbose application logging. | false |
*Required
For a complete list of all environment variables with detailed explanations, see .env.example.
TRUENAS_API_KEY=your-api-key-hereenvironment:
- TRUENAS_API_KEY=your-api-key-here
With the API key configured, portracker will display:
Without the API key, you'll only see Docker containers and system ports.
For timeout configuration options, see .env.example.
portracker includes optional authentication to secure dashboard access:
ENABLE_AUTH=true in your environment variablesSESSION_SECRET to avoid being logged out on container restartExample with Authentication:
services:
portracker:
image: mostafawahied/portracker:latest
environment:
- ENABLE_AUTH=true
- SESSION_SECRET=your-random-secret-here-change-this
Important Notes:
Host header; otherwise set CORS_ORIGIN to the exact public origin, including https://If you run autoxpose to manage your public-facing services, portracker can display which ports are publicly exposed alongside their internal addresses.
Setup:
http://autoxpose:3000)After upgrading to v1.3.11, reconnect an existing autoxpose integration once while signed in. Private LAN and container-DNS addresses remain supported. Loopback, link-local, reserved, credential-bearing, query-bearing, and redirecting destinations are rejected; use the autoxpose service name or LAN address instead of localhost.
What You'll See:
Once connected, exposed services show a public URL chip or globe badge next to the port:
🌐 photos.example.com 🔒Display Options:
SSL Status Indicators:
| Icon | Color | Status |
|---|---|---|
| 🔒 | Green | SSL secured |
| ⚠️ | Amber | SSL pending |
| ❌ | Red | SSL error |
Future development is focused on improving the application based on community feedback. Key areas include:
Contributions are welcome! Please feel free to open an issue to report a bug or suggest a feature, or submit a pull request with your improvements.
This project is licensed under the MIT License - see the LICENSE
44 followers · starred Jul 2025
255 followers · starred Aug 2025
49 followers · starred Sep 2026
56 followers · starred Jul 2025
An open source, self-hosted, real-time port monitoring and discovery tool.
JavaScript
2,472
91 commits
updated Oct 8, 2026
A self-hosted, real-time port monitoring and discovery tool.
By auto-discovering services on your systems, portracker provides a live, accurate map of your network. It helps eliminate manual tracking in spreadsheets and prevents deployment failures caused by port conflicts.
portracker instances as peers to view all your servers, containers, and VMs from a single dashboard.portracker instance under its physical host.portracker to discover running VMs* and gather enhanced system information like the OS version and uptime.*Note: VMs discovered on TrueNAS with the optional API key are shown in read-only mode. To enable full monitoring, deploy a portracker instance on each VM and add it as a separate server.
Deployment is designed to be simple using Docker.
Using Docker Compose:
Create a docker-compose.yml file:
services:
portracker:
image: mostafawahied/portracker:latest
container_name: portracker
restart: unless-stopped
pid: "host" # Required for port detection
# Required permissions for system ports service namespace access
cap_add:
- SYS_PTRACE # Linux hosts: read other PIDs' /proc entries
- SYS_ADMIN # Docker Desktop: allow namespace access for host ports (required for MacOS)
security_opt:
- apparmor:unconfined # Required for system ports
volumes:
# Required for data persistence
- ./portracker-data:/data
# Required for discovering services running in Docker
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- "4999:4999"
# environment:
# Optional: For enhanced TrueNAS features
# - TRUENAS_API_KEY=your-api-key-here
Then, run the application:
docker-compose up -d
Using Docker Run:
docker run -d \
--name portracker \
--restart unless-stopped \
--pid host \
--cap-add SYS_PTRACE \
--cap-add SYS_ADMIN \
--security-opt apparmor=unconfined \
-p 4999:4999 \
-v ./portracker-data:/data \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
mostafawahied/portracker:latest
For enhanced security, you can run portracker without direct access to the Docker socket by using a proxy. This restricts the Docker API permissions to read-only operations.
Using Docker Compose:
services:
docker-proxy:
image: tecnativa/docker-socket-proxy:latest
container_name: portracker-docker-proxy
restart: unless-stopped
environment:
- CONTAINERS=1
- IMAGES=1
- INFO=1
- NETWORKS=1
- POST=0
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- "2375:2375"
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
ports:
- "4999:4999"
environment:
- DOCKER_HOST=tcp://docker-proxy:2375
depends_on:
- docker-proxy
Using Docker Run:
# Start the Docker proxy
docker run -d \
--name portracker-docker-proxy \
--restart unless-stopped \
-p 2375:2375 \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-e CONTAINERS=1 \
-e IMAGES=1 \
-e INFO=1 \
-e NETWORKS=1 \
-e POST=0 \
tecnativa/docker-socket-proxy:latest
# Start portracker
docker run -d \
--name portracker \
--restart unless-stopped \
--pid host \
--cap-add SYS_PTRACE \
--cap-add SYS_ADMIN \
--security-opt apparmor=unconfined \
-p 4999:4999 \
-v ./portracker-data:/data \
-e DOCKER_HOST=tcp://localhost:2375 \
mostafawahied/portracker:latest
Configure portracker using environment variables.
| Variable | Description | Default |
|---|---|---|
PORT* | The port the web application will run on. | 4999 |
DATABASE_PATH* | Path inside the container to the SQLite database file. | /data/portracker.db |
TRUENAS_API_KEY | Optional API key for enhanced TrueNAS data collection. | |
ENABLE_AUTH | Set to true to enable authentication (v1.2.0+). | false |
SESSION_SECRET | Only needed with auth enabled. Prevents logout on container restart. | random |
CORS_ORIGIN | Comma-separated browser origins for a separately hosted frontend or a reverse proxy that rewrites Host. Same-origin access needs no setting. | disabled |
CACHE_TIMEOUT_MS | Duration in milliseconds to cache scan results. | 60000 |
DISABLE_CACHE | Set to true to disable all caching. | false |
INCLUDE_UDP | Set to true to include UDP ports in scans. | false |
MAX_INTERNAL_PORTS_PER_CONTAINER | Maximum unpublished internal ports listed for one container. Containers above the limit keep published ports but omit internal rows. | 100 |
DEBUG | Set to true for verbose application logging. | false |
*Required
For a complete list of all environment variables with detailed explanations, see .env.example.
TRUENAS_API_KEY=your-api-key-hereenvironment:
- TRUENAS_API_KEY=your-api-key-here
With the API key configured, portracker will display:
Without the API key, you'll only see Docker containers and system ports.
For timeout configuration options, see .env.example.
portracker includes optional authentication to secure dashboard access:
ENABLE_AUTH=true in your environment variablesSESSION_SECRET to avoid being logged out on container restartExample with Authentication:
services:
portracker:
image: mostafawahied/portracker:latest
environment:
- ENABLE_AUTH=true
- SESSION_SECRET=your-random-secret-here-change-this
Important Notes:
Host header; otherwise set CORS_ORIGIN to the exact public origin, including https://If you run autoxpose to manage your public-facing services, portracker can display which ports are publicly exposed alongside their internal addresses.
Setup:
http://autoxpose:3000)After upgrading to v1.3.11, reconnect an existing autoxpose integration once while signed in. Private LAN and container-DNS addresses remain supported. Loopback, link-local, reserved, credential-bearing, query-bearing, and redirecting destinations are rejected; use the autoxpose service name or LAN address instead of localhost.
What You'll See:
Once connected, exposed services show a public URL chip or globe badge next to the port:
🌐 photos.example.com 🔒Display Options:
SSL Status Indicators:
| Icon | Color | Status |
|---|---|---|
| 🔒 | Green | SSL secured |
| ⚠️ | Amber | SSL pending |
| ❌ | Red | SSL error |
Future development is focused on improving the application based on community feedback. Key areas include:
Contributions are welcome! Please feel free to open an issue to report a bug or suggest a feature, or submit a pull request with your improvements.
This project is licensed under the MIT License - see the LICENSE
44 followers · starred Jul 2025
255 followers · starred Aug 2025
49 followers · starred Sep 2026
56 followers · starred Jul 2025