Docker: How to control/define default gateway settings

Viewed 10232

Can anyone shed some light on what is what with the Docker Compose YML file? All I want to do is to be able to control the IP addresses of the various containers. I am using version 3.1 (but also tried 3.3 as I recently upgraded to version 17.06). The documentation says:

A full example:

ipam:
  driver: default
  config:
    - subnet: 172.28.0.0/16
Note: Additional IPAM configurations, such as gateway, are only honored for version 2 at the moment.

When I do this, I need that subnet honored when I inspect the network. However the gateway is completely different [read the Note: above], so the containers do not start. Why did they lose capability (at the moment) in version 3 for something that worked in version 2? Worse, why wasn't that restored in version 3.2 or 3.3?

Maybe I am way off base here - certainly wouldn't be first time! What is most important to me: is there a way to modify a compose file to allow a docker stack deploy command (in a Docker Swarm) to provide control of the gateway and subnets used?

2 Answers
Related