One approach you can take that doesn’t involve pipework would be to add a bunch of IPs to your host machine. When you publish a port, you can specify the IP address it binds to.
Say I have a docker host, and it has the IP 198.51.100.10. If I do
docker run -d -p 80:80 nginx, docker will bind to 0.0.0.0:80, which means my nginx container is using port 80 on 127.0.0.1 and 198.51.100.10.
If I add another ip address to the host, 198.51.100.12, and do the same thing, then I’d be able to access nginx on all three addresses: 127.0.0.1, 198.51.100.10, and 198.51.100.12.
If I delete the old one and launch a new container,
docker run -d -p 198.51.100.12:80:80 nginx, then my nginx is only using port 80 on that one ip address. Port 80 on 127.0.0.1 and on 198.51.100.10 are still both closed, and can be used by another process.
It’s not exactly what you are asking for, but it just might serve your use-case.