Skip to content

Network gateway: Address already in use #8742

@eirikb

Description

@eirikb

Description

Trying to set a gateway to a specific address, but it won't be set.
If I try to set it to 10.10.1.100 the bridge adapter will still be set to 10.10.1.1.
This worked fine in v1, so unless the configuration have changed it could be a bug in v2.

Example:

services:
  A:
    image: nginx
    networks:
      mynet:
        ipv4_address: '10.10.1.1'
networks:
  mynet:
    ipam:
      config:
        - subnet: '10.10.1.0/24'
          gateway: '10.10.1.100'
eirikb@eh ~/d/t/test> docker network ls
NETWORK ID     NAME         DRIVER    SCOPE
a6cd841ba53a   bridge       bridge    local
4a5d7a11984c   host         host      local
66153911b158   none         null      local
d5c0ad6095d8   test_mynet   bridge    local
eirikb@eh ~/d/t/test> ip a | grep 10.10
    inet 10.10.1.1/24 brd 10.10.1.255 scope global br-d5c0ad6095d8
eirikb@eh ~/d/t/test> docker network inspect test_mynet
...
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "10.10.1.0/24"
                }
            ]
        },
...

Steps to reproduce the issue:

  1. Create a file docker-compose.yml with contents as described above
  2. Run docker-compose up

Describe the results you received:

eirikb@eh ~/d/t/test> docker-compose up
[+] Running 2/2
 ⠿ Network test_mynet  Created                                                                                                                                                                                 0.0s
 ⠿ Container test-A-1  Created                                                                                                                                                                                 0.5s
Attaching to test-A-1
Error response from daemon: Address already in use

Describe the results you expected:

No error

Output of docker compose version:

Docker Compose version 2.0.1

Additional environment details:

Tested on two different computers. Both running Arch Linux. Both Docker and Compose are from pacman.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions