# Port Conflict during canton network setup with one domain and two participants

**URL:** <https://forum.canton.network/t/port-conflict-during-canton-network-setup-with-one-domain-and-two-participants/7890>\
**Category:** App Development\
**Tags:** daml, canton\
**Created:** [April 17, 2025, 12:04pm UTC](https://forum.canton.network/t/port-conflict-during-canton-network-setup-with-one-domain-and-two-participants/7890 "2025-04-17T12:04:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sindhusha](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@Sindhusha](https://forum.canton.network/u/Sindhusha)\
**Post date:** [April 17, 2025, 12:04pm UTC](https://forum.canton.network/t/port-conflict-during-canton-network-setup-with-one-domain-and-two-participants/7890/1 "2025-04-17T12:04:18Z")

</div>

Hello All,

I am setting up a canton network in dockerized containers where i am maintaining different configuration files for each participant and the domain .Please find config and docker-compose.yaml`Preformatted text` file below

````haskell
canton {
  domains {
    domain1 {
      storage {
        type = memory
      }
      public-api {
        address = "0.0.0.0"
        port = 17123 # Changed from 7123 to match compose file
      }
      admin-api {
        address = "0.0.0.0"
        port = 19127 # Changed from 8126 to match compose file
      }
    }
  }
}
```version: '3.8'

services:
  domain:
    image: digitalasset/canton-open-source:2.7.9
    container_name: domain
    ports:
      - "59127:19127"  
      - "58124:17123"  
    volumes:
      - ./config/domain1.conf:/etc/canton/domain1.conf
      - ./scripts:/scripts
      - /home/simadmin/instrument_tokenization/scripts/canton-release:/opt/canton
    environment:
      - PATH=/opt/canton/bin:$PATH
    command: ["daemon", "-c", "/etc/canton/domain1.conf"]
 
  participant-admin:
    image: digitalasset/canton-open-source:2.7.9
    container_name: participant-admin
    depends_on:
      - domain
    ports:
      - "56002:16002"  
      - "59002:19002"  
    volumes:
      - ./config/participant1-admin.conf:/etc/canton/participant1-admin.conf
      - ./scripts:/scripts
      - /home/simadmin/instrument_tokenization/scripts/canton-release:/opt/canton
    environment:
      - PATH=/opt/canton/bin:$PATH
    command: ["daemon", "-c", "/etc/canton/participant1-admin.conf"]
 
  participant-investor:
    image: digitalasset/canton-open-source:2.7.9
    container_name: participant-investor
    depends_on:
      - domain
    ports:
      - "54002:14002"  
      - "55002:15002" 
    volumes:
      - ./config/participant2-investor.conf:/etc/canton/participant2-investor.conf
      - ./scripts:/scripts
      - /home/simadmin/instrument_tokenization/scripts/canton-release:/opt/canton
    environment:
      - PATH=/opt/canton/bin:$PATH
    command: ["daemon", "-c", "/etc/canton/participant2-investor.conf"]`

I am facing port conflict issue with admin api port of domain .I am able to set up once but after trying to do it next day with docker starting fresh i am running into this issue
Here are the logs .....
Setting up domain...
Successfully copied 2.05kB to domain:/tmp/domain.sc
Exception in thread "main" java.io.IOException: Failed to bind to address /0.0.0.0:19127
Caused by: java.net.BindException: Address already in use

I have tried changing port numbers along killing processes if required seems the error is still persisting .Can you please suggest a solution.
````

---

<div class="post-metadata">

**Author:** ![WallaceKelly](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/wallacekelly/32/5046_2.png) [@WallaceKelly](https://forum.canton.network/u/WallaceKelly)\
**Post date:** [April 17, 2025, 1:41pm UTC](https://forum.canton.network/t/port-conflict-during-canton-network-setup-with-one-domain-and-two-participants/7890/2 "2025-04-17T13:41:35Z")

</div>

The only idea that comes to mind is that the previous day’s containers are still running. Can you try the following?

When you get the “Address already in use”, run:

```haskell
docker ps --all --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}\t{{.Status}}"

```

What do you see?

---

<div class="post-metadata">

**Author:** ![Sindhusha](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@Sindhusha](https://forum.canton.network/u/Sindhusha)\
**Post date:** [April 17, 2025, 4:09pm UTC](https://forum.canton.network/t/port-conflict-during-canton-network-setup-with-one-domain-and-two-participants/7890/3 "2025-04-17T16:09:38Z")

</div>

Mr. Kelly,  
Thanks for the response !!

I’ve streamlined the setup by consolidating the configuration files for all domains and participants into a single one as follows `canton {  
participants {  
participant1 {  
storage.type = memory  
admin-api.port = 5012  
ledger-api.port = 5011  
}  
participant2 {  
storage.type = memory  
admin-api.port = 5022  
ledger-api.port = 5021  
}  
}  
domains {  
mydomain {  
init.domain-parameters.protocol-version = 5  
storage.type = memory  
public-api.port = 5018  
admin-api.port = 5019  
}  
}

features.enable-testing-commands = yes  
}  
`and also updated the`docker-compose.yaml`as`version: ‘3.8’

services:  
canton:  
image: digitalasset/canton-open-source:2.7.9  
container\_name: canton  
ports:  
# Participant 1 ports  
- “56002:5012” # participant1 admin-api  
- “59002:5011” # participant1 ledger-api

```
  # Participant 2 ports
  - "54002:5022" # participant2 admin-api
  - "55002:5021" # participant2 ledger-api

  # Domain ports
  - "58147:5018" # domain public-api
  - "59137:5019" # domain admin-api

volumes:
  - ./config/canton.conf:/etc/canton/canton.conf
  - ./scripts:/scripts
  - /home/simadmin/instrument_tokenization/scripts/canton-release:/opt/canton

environment:
  - PATH=/opt/canton/bin:$PATH

command: ["daemon", "-c", "/etc/canton/canton.conf"]

```

ERROR :`Successfully copied 2.56kB to canton:/tmp/bootstrap.sc Exception in thread "main" java.io.IOException: Failed to bind to address /127.0.0.1:5019`  
Caused by: java.net.BindException: Address already in use` To investigate this I have used command suggested by you`docker ps --all --format “table {{.ID}}\t{{.Names}}\t{{.Ports}}\t{{.Status}}”  
The output shows that the canton container is already mapping port 5019 internally to the host port 59137``CONTAINER ID NAMES PORTS  
8455334f5779 canton 0.0.0.0:59002-\>5011/tcp, [::]:59002-\>5011/tcp,  
0.0.0.0:56002-\>5012/tcp, [::]:56002-\>5012/tcp,  
0.0.0.0:58147-\>5018/tcp, [::]:58147-\>5018/tcp,  
0.0.0.0:59137-\>5019/tcp, [::]:59137-\>5019/tcp,  
0.0.0.0:55002-\>5021/tcp, [::]:55002-\>5021/tcp,  
0.0.0.0:54002-\>5022/tcp, [::]:54002-\>5022/tcp Up 3 minutes  
Using this approach, I can clearly see the list of containers along with their port mappings and quickly identify conflicts, especially when comparing against my `docker-compose.yml` configuration.  
`
