Skip to content

On container re-creation, doesn't use the fixed IP  #78

@serut

Description

@serut

In the stack we are using, we've created a docker network with a subnet, to be able to use a fixed IP for a container.
docker network create --driver bridge my_network --subnet 10.11.1.0/24
Then we boot the service like this, using docker-compose.

  my_service:
    image: myCustomRegistry:5000/my_service
    container_name: my_service
    networks:
      my_network:
        ipv4_address: 10.11.1.100
   another_service:
     [...]
     networks:
        - my_network

However, my container have been rebooted by the watchtower but did not conserved the fixed IP.

[root@vm]# docker exec -ti another_service bash

# ping 10.11.1.100
PING 10.11.1.100 (10.11.1.100): 56 data bytes
^C
--- 10.11.1.100 ping statistics ---
13 packets transmitted, 0 packets received, 100% packet loss

# ping my_service
PING my_service (10.11.1.11): 56 data bytes
64 bytes from 10.11.1.11: seq=0 ttl=64 time=0.295 ms
64 bytes from 10.11.1.11: seq=1 ttl=64 time=0.122 ms
64 bytes from 10.11.1.11: seq=2 ttl=64 time=0.131 ms
64 bytes from 10.11.1.11: seq=3 ttl=64 time=0.131 ms
64 bytes from 10.11.1.11: seq=4 ttl=64 time=0.131 ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions