Skip to content

Docker 1.13.1 swarm-mode compose not assign the correct static addresses #4471

Closed
@vmptk

Description

I have defined a static addresses for the service, however the compose is not setting them, but a random ones.

Server Version:

1.13.1

Configuration

Stack yml file:

version: "3"
#-------------------------------------
services:
  proxy:
    image: nginx
    ports:
      - "80:80"
    networks:
      backend:
        ipv4_address: 192.168.1.5
        aliases:
          - proxy
    depends_on: ["jenkins"]

  jenkins:
    image: jenkins
    networks:
      backend:
        ipv4_address: 192.168.1.10
        aliases:
          - jenkins
    volumes:
       - "jenkins:/var/jenkins_home"
    deploy:
      labels: [APP=JENKINS]

#-------------------------------------
volumes:
  jenkins:

networks:
  backend:
    driver: overlay
    ipam:
      driver: default
      config:
        - subnet: 192.168.1.0/24

and the network inspect assign the random address:

xxxx~$  docker network inspect dev_backend
[
    {
        "Name": "dev_backend",
        "Id": "xebslpl1qudzltvpgz25eafth",
        "Created": "2017-02-11T01:42:24.968212835+01:00",
        "Scope": "swarm",
        "Driver": "overlay",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.1.0/24",
                    "Gateway": "192.168.1.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Containers": {
            "836f5d1cdef7627a3385a63c8230765706fd1a949752851a570ef762ea560f71": {
                "Name": "dev_proxy.1.sm9agr0vzf01q7f2kodefzjtq",
                "EndpointID": "9a5e0995c0fc4623a1316e6dc4bea7f32859e36b36983a10a8e59a55c28f49b0",
                "MacAddress": "02:42:c0:a8:01:03",
                "IPv4Address": "192.168.1.3/24",
                "IPv6Address": ""
            }
        },
        "Options": {
            "com.docker.network.driver.overlay.vxlanid_list": "4097"
        },
        "Labels": {
            "com.docker.stack.namespace": "dev"
        },
        "Peers": [
            {
                "Name": "xxxx-4be317a5df89",
                "IP": "10.21.39.174"
            },
            {
                "Name": "xxxxx-e2e24a1eacbc",
                "IP": "10.21.44.37"
            }
        ]
    }
]

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