I am setting the subnet and gateway in my docker-compose file as variables. It looks like this:
networks:
btgnetwork:
driver: bridge
ipam:
driver: default
config:
- subnet: ${STAGE_NETWORK_IP}.0/24
gateway: ${STAGE_NETWORK_IP}.1
The variable is set in another file called "compose-vars.env" with STAGE_NETWORK_IP=192.168.2
But this does not work. The Error is:
ERROR: The Compose file './docker-compose.yml' is invalid because:
networks.btgnetwork.ipam.config.subnet is invalid: should use the CIDR format
I cloud not find any useful tips for that. Thank you :)
Try to use quotes: