From the official doc, the static IP address should work with docker creating swarm v3 + dockers. But I can’t make it work.
This is my docker creating yaml:
version: '3'
networks:
test:
ipam:
driver: default
config:
- subnet: 10.1.0.0/24
services:
one:
image: mongo
networks:
test:
ipv4_address: '10.1.0.100'
two:
image: mongo
networks:
test:
ipv4_address: '10.1.0.101'
three:
image: mongo
networks:
test:
ipv4_address: '10.1.0.102'
I use docker stack up -c xxx.yml testfor deployment. I found the ip created containers 10.1.0.3, 10.1.0.5, ...
source
share