# Docker mutiple port issue

**URL:** <https://forums.docker.com/t/docker-mutiple-port-issue/66567>\
**Category:** General\
**Created:** [January 8, 2019, 2:25pm UTC](https://forums.docker.com/t/docker-mutiple-port-issue/66567 "2019-01-08T14:25:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![reddychaitu2002](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@reddychaitu2002](https://forums.docker.com/u/reddychaitu2002)\
**Post date:** [January 8, 2019, 2:25pm UTC](https://forums.docker.com/t/docker-mutiple-port-issue/66567/1 "2019-01-08T14:25:20Z")

</div>

Hi,

I am currently working on two inter related [ASP.NET](http://ASP.NET) Core WebAPI services (Service1 & Service2) in a solution. Both are having docker files and Exposing port 80.

Service1 is an independent service and required to be called from Service2. I have given both docker-compose.yml and docker-compose.override.yml.

**docker-compose.yml**

```
version: '3.4'

services:
  services1:
    image: ${DOCKER_REGISTRY-}services1
    network_mode: bridge
    build:
      context: .
      dockerfile: Services1/Dockerfile
    ports:
     - "501:80"
     
  services1:
    image: ${DOCKER_REGISTRY-}services2
    network_mode: bridge
    build:
      context: .
      Services2/Dockerfile
    ports:
     - "502:80"

```

**docker-compose.override.yml**

```
version: '3.4'

services:
  services1:
    build:
      context: .
      dockerfile: Services1/Dockerfile
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
    ports:
      - "1001:80"

  services2:
    build:
      context: .
      Services2/Dockerfile
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - SERVICE1=http://localhost:1001
      ports:
      - "1002:80"	 

```

When i call **Service1(localhost:1001)** from **Service2(localhost:1002)** with **network\_mode: bridge** , I am getting the below exception.

> {System.Net.Http.HttpRequestException: Cannot assign requested address —\> System.Net.Sockets.SocketException: Cannot assign requested address

when i change the network\_mode to host ( **network\_mode:host** ), i am getting the below exception.

> System.IO.IOException: ‘Failed to bind to address http://[::]:80: address already in use.’

So please let me know how to resolve the issue.
