traccar: exclude Asterisk's AMI port (5038/tcp) from the published range

Confirmed live: on a box also running Asterisk from this repo,
`docker network connect caddy_net traccar` failed with "failed to bind
host port 0.0.0.0:5038/tcp: address already in use". Asterisk runs with
network_mode: host (services/asterisk.sh), so its AMI (port 5038,
hardcoded in services/sms-inbound.sh) binds directly on the host's
network stack — no Docker NAT involved. Traccar's docker-compose.yml
published the entire 5000-5150 range for device protocols, which
needs Docker to also bind host port 5038 for its own port-forwarding,
directly colliding with Asterisk's AMI on any box running both
services from this repo.

Split the TCP range into 5000-5037 and 5039-5150 to skip that one
port; left UDP as a single 5000-5150 range since AMI is TCP-only.
This commit is contained in:
Claude
2026-08-03 20:56:41 +00:00
parent 737bc873d1
commit 78692c5999
+13 -3
View File
@@ -196,7 +196,7 @@ install_traccar() {
echo " - Deploy a PostgreSQL database container (Traccar no longer ships H2)" echo " - Deploy a PostgreSQL database container (Traccar no longer ships H2)"
echo " - Point Traccar at it via env vars (CONFIG_USE_ENVIRONMENT_VARIABLES) — no secrets in a config file" echo " - Point Traccar at it via env vars (CONFIG_USE_ENVIRONMENT_VARIABLES) — no secrets in a config file"
echo " - Deploy an autoheal container that restarts Traccar if its healthcheck fails" echo " - Deploy an autoheal container that restarts Traccar if its healthcheck fails"
echo " - Expose port 8082 (web) and 5000-5150 (device protocols)" echo " - Expose port 8082 (web) and 5000-5150 (device protocols; 5038/tcp skipped — Asterisk AMI)"
echo " - No default login — register the first account at the web UI, it becomes admin" echo " - No default login — register the first account at the web UI, it becomes admin"
echo " - Offer a Caddy reverse proxy and to start the container" echo " - Offer a Caddy reverse proxy and to start the container"
return 0 return 0
@@ -287,7 +287,16 @@ ${_CADDY_NET_BLOCK} healthcheck:
- ./data:/opt/traccar/data:rw - ./data:/opt/traccar/data:rw
ports: ports:
- "8082:8082" - "8082:8082"
- "5000-5150:5000-5150" # 5038/tcp is skipped: it's Asterisk's AMI port (services/asterisk.sh
# runs Asterisk with network_mode: host, so AMI binds it directly on
# the host, not through Docker networking). Publishing the full
# 5000-5150 range here would fight Asterisk for that exact host port
# on any box running both services from this repo. Confirmed live:
# this is what made "docker network connect caddy_net traccar" fail
# with "failed to bind host port 0.0.0.0:5038/tcp: address already in
# use" on a box with Asterisk's PSTN trunk already installed.
- "5000-5037:5000-5037"
- "5039-5150:5039-5150"
- "5000-5150:5000-5150/udp" - "5000-5150:5000-5150/udp"
${_CADDY_NET_BLOCK} ${_CADDY_NET_BLOCK}
autoheal: autoheal:
@@ -336,7 +345,8 @@ Android/iOS app, OwnTracks, or any of 200+ supported device protocols.
stays open to anyone who reaches this server until you turn it off, so do stays open to anyone who reaches this server until you turn it off, so do
this right away, then go to Settings → Server → Permissions and uncheck this right away, then go to Settings → Server → Permissions and uncheck
Registration. Registration.
- Device protocols: ports 5000-5150 (TCP + UDP) - Device protocols: ports 5000-5150 (TCP + UDP; 5038/tcp is skipped — reserved
for Asterisk's AMI if this box also runs Asterisk from this repo)
- App data: \`data/\` and \`logs/\` - App data: \`data/\` and \`logs/\`
- Database: PostgreSQL (\`traccar-db\` container, data in \`db/\`) - Database: PostgreSQL (\`traccar-db\` container, data in \`db/\`)
- All database settings (name, user, password) live in \`.env\` — Traccar - All database settings (name, user, password) live in \`.env\` — Traccar