Answers: <p>If you pass the listen address as the very first component of <code>-p</code>, Docker will only listen on that address:</p>
  <pre><code>$ 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:*
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2020-06-29T21:51:23.543Z
Answers: Hmm, what if I want to transmit on that port?
Answers: fcimeson
Answers: CC BY-SA 4.0
Answers: 2020-06-30T09:37:31.340Z
Answers: You mean, outgoing with that IP?
Answers: thriqon
Answers: CC BY-SA 4.0
Answers: 2020-06-30T16:20:33.393Z
Answers: Yes, outgoing with that IP.
Answers: fcimeson
Answers: CC BY-SA 4.0
Answers: 2020-06-28T20:27:25.987Z
Answers: 2020-06-28T20:27:25.987Z
Answers: thriqon
Body: <p><strong>Problem:</strong> 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).</p>
  <p>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.</p>
  <p>Is there a docker way to create a second IP address and avoid this problem?</p>
  <p>Thanks</p>
  
Tags: <docker><networking>
Title: How to create a second IP just for dockers
UserDisplayName: fcimeson
ThreadText: # How to create a second IP just for dockers
  
  (Asked by: username_0 on 2020-06-28)
  
  **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
  
  **Tags:** docker, networking
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-06-28. Score: 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:*
  
  ```
  
  > **Comments:**
  > **username_0**: Hmm, what if I want to transmit on that port?  
  > **username_1**: You mean, outgoing with that IP?  
  > **username_0**: Yes, outgoing with that IP.  
  
  ---
  
  