brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: change the host port in an Unraid template, leave the container port alone

Unraid
~/tips/tip-unraid-docker-change-host-port-only

Container port: 8000 Host port: 8000

Solve a port clash between containers by changing only the host side of the mapping.

Run enough containers and two of them will want the same port. With a busy Unraid box full of web apps, that happens faster than you would think. The fix is in the template, as long as you change the right half.

On a bridge network a port mapping has two numbers: the port inside the container and the port on your Unraid server. The docs are clear about which one you touch:

Only modify the host port value.

The app inside the container still listens on its own port. You only change where it shows up on the server. The docs give the example of three containers that all use port 8000 internally, mapped to 8000, 8001 and 8002 on the host. In the template that looks like:

Container port: 8000   Host port: 8000
Container port: 8000   Host port: 8001
Container port: 8000   Host port: 8002

You then reach the second one at http://tower:8001. Click Edit in the container’s context menu, change the host port, apply, done.

If you change the container port instead, the app keeps listening on 8000 while Docker forwards traffic to a port where nobody answers. The page simply does not load, and you start debugging the wrong thing.

The caveat is host networking. A container on the Host network type shares the server’s network stack, so there is no mapping to edit. The docs only say to avoid running several containers with the same port there, which means the change has to happen in the app’s own settings.

Further reading: Unraid docs: Managing & customizing containers

More Unraid tips Change the RAID profile of a Unraid BTRFS pool with Balance Replace a disk in a redundant Unraid pool from the Main tab Test every Unraid drive with the DiskSpeed container See the XML behind a VM with the inline XML view in Unraid 7 Choose where a new VM's disk image is created with Unraid's storage override All Unraid tips (77) All topics

Link