1

Problem: my server is already using port 80 and I would like launch another service that uses port 80 on another address (I don't want to remember ports or force my wife to use non-default ports).

I've created a secondary IP address for all of my dockers (the dockers themselves will only map their ports to one address) but my server grabs port 80 for the default service on both addresses.

Is there a docker way to create a second IP address and avoid this problem?

Thanks

1

If you pass the listen address as the very first component of -p, Docker will only listen on that address:

$ docker run -p 127.0.1.2:8080:80 -d nginx`
$ ss -ltp | grep 127.0.1.2
LISTEN  0       4096         127.0.1.2:http-alt          0.0.0.0:*
3
  • Hmm, what if I want to transmit on that port?
    – fcimeson
    Jun 29 '20 at 21:51
  • You mean, outgoing with that IP?
    – thriqon
    Jun 30 '20 at 9:37
  • Yes, outgoing with that IP.
    – fcimeson
    Jun 30 '20 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.