Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] compose network aux_adresses not correctly handled #12515

Closed
disk91 opened this issue Feb 1, 2025 · 1 comment
Closed

[BUG] compose network aux_adresses not correctly handled #12515

disk91 opened this issue Feb 1, 2025 · 1 comment

Comments

@disk91
Copy link

disk91 commented Feb 1, 2025

Description

When trying to fix the IpAddress for a container, the expected IP address is not taken by the container and still randomly assigned through dhcp.

Steps To Reproduce

docker-compose.yml file extract:

... 
  postgres:
    image: postgres:14-alpine
    restart: unless-stopped
    command: postgres -c 'max_connections=250'
    volumes:
      - /helium/configuration/postgresql/initdb:/docker-entrypoint-initdb.d
      - /helium/postgresql:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=root
    networks:
      - internal_net
    logging: *logs
...

networks:
  internal_net:
    ipam:
      driver: default
      config:
        - subnet: 172.91.0.0/24
          ip_range: 172.91.0.0/25
          gateway: 172.91.0.254
          aux_addresses:
            postgres: 172.91.0.130
            mongo: 172.91.0.131

As a result avec docker compose down ; docker compose up -d ; docker inspect xxxxx-postgres-1

"Networks": {
                "helium_internal_net": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": [
                        "helium-postgres-1",
                        "postgres"
                    ],
                    "MacAddress": "02:42:ac:5b:00:07",
                    "DriverOpts": null,
                    "NetworkID": "656e5a83f6b65073ac31614cc67b0706e8786e48d1babf1b1b74472eec0e18cd",
                    "EndpointID": "7780ea1b93d42b981ceaf7236c99086c2d7e809c5dea4f53d29c4f12f6452290",
                    "Gateway": "172.91.0.254",
                    "IPAddress": "172.91.0.7",
                    "IPPrefixLen": 24,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",

The IPAddress does not patch the expected on 172.91.0.7 != 172.91.0.130
Already tested : aux_addresses inside the ip_range, rename the aux_address container name with xxxxx-postgres-1 ...

Compose Version

Docker Compose version v2.32.4

Docker Environment

Client: Docker Engine - Community
 Version:    27.5.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.20.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.32.4
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 28
  Running: 27
  Paused: 0
  Stopped: 1
 Images: 58
 Server Version: 27.5.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
 runc version: v1.2.4-0-g6c52b3f
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.0-131-generic
 Operating System: Ubuntu 22.04.5 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 7.751GiB
 Name: helium-xyz-staging
 ID: d8288c58-c144-433d-a312-b9a9c04a0289
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

No response

@disk91 disk91 changed the title [BUG] compose network aux_adresses not coorectly handled [BUG] compose network aux_adresses not correctly handled Feb 1, 2025
@ndeloof
Copy link
Contributor

ndeloof commented Feb 3, 2025

aux_addresses role is not to set container's IP over network, but to register hostnames->IP mappings, typically to exclude some IP addresses to be assigned (which is the opposite for your expectations)

See https://github.com/compose-spec/compose-spec/blob/main/05-services.md#ipv4_address-ipv6_address for selecting IP address assigned to container

@ndeloof ndeloof closed this as not planned Won't fix, can't repro, duplicate, stale Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants