title: Assign outgoing IP for docker container via docker-compose
body: <p>I have a server with 2 IPs that I need to run 3 docker containers on. </p>
  
  <p>One container is an nginx reverse proxy that takes incoming connections on the first IP. </p>
  
  <p>The second containers uses the same IP to connect externally, I have this portion working.</p>
  
  <p>What I need to do now, is setup a network to let the last container to access external services via the second IP, but still allow the nginx container to access it's ports. </p>
  
  <p>Is there a way to do this in docker-compose? I'd rather not go down the kubernetes / swarm path if I didn't have to. </p>
  
  <pre><code>version: '2'
  services:
    nginx:
      image: jwilder/nginx-proxy
      environment:
        - VIRTUAL_PORT=8000
      volumes:
        - /var/run/docker.sock:/tmp/docker.sock:ro
      ports:
        - "80:80"
  
  
    python:
      depends_on:   
        - nginx
      image: python:2.7-slim
      restart: always
      working_dir: /usr/src/app/
        - VIRTUAL_HOST=python.mydomain.com
      expose:
      - "8000"
      volumes:
      - "./:/usr/src/app/"
      command: bash -c "~/do_some_stuff.sh"
  </code></pre>
  
  <p>I've already tried to add a bridge network, but I couldn't get it working as it seemed to use my main IP still. Then I tried assigning the IP statically in the container, which didn't work either as the routing didn't function. </p>
  
  <p>It seems like this should be possible, I'm just not sure if I'm searching for the wrong things or don't understand the documentation properly. </p>