Network gateway not set
Brought to you by:
austinsuero97
Originally created by: rvernica
By default docker-compose creates a network which contains:
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1"
}
]
}
I want to change the subnet due to conflicts, so in my docker-compose.yml I add:
version: '3.7'
...
networks:
default:
ipam:
config:
- subnet: 192.168.2.0/24
This creates a network with the expected subnet but the gateway entry is lost:
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "192.168.2.0/24"
}
]
},
Output of docker-compose version
> docker-compose version
docker-compose version 1.23.2, build 1110ad0
docker-py version: 3.7.0
CPython version: 2.7.5
OpenSSL version: OpenSSL 1.0.2k-fips 26 Jan 2017
Output of docker version
> docker version
Client:
Version: 18.09.1
API version: 1.39
Go version: go1.10.6
Git commit: 4c52b90
Built: Wed Jan 9 19:35:01 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.1
API version: 1.39 (minimum version 1.12)
Go version: go1.10.6
Git commit: 4c52b90
Built: Wed Jan 9 19:06:30 2019
OS/Arch: linux/amd64
Experimental: false
Ticket changed by: ijc
Originally posted by: ijc
I think you need to specify the gateway explicitly if you want one since there is no default (this is the behaviour of the underlying engine too, at least in my experiments with 18.09.1).
I'll close this issue since it is behaving as I would have expected.