When I configure the Docker Swarm ingress
network with --internal
, the configuration is correctly applied. However, as soon as I create a service with a port published in ingress mode, Docker automatically switches Ingress
from True
to False
.
Why Docker is refusing to have the ingress
network be internal
?
After creating the network:
[
{
"Name": "ingress",
"Id": "yd5qtckhne6p4pxibziqhvy9y",
"Created": "2025-06-06T12:48:16.694132526Z",
"Scope": "swarm",
"Driver": "overlay",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.20.0.0/24",
"Gateway": "172.20.0.1"
}
]
},
"Internal": true,
"Attachable": false,
"Ingress": true,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": null,
"Options": {
"com.docker.network.container_iface_prefix": "ingress",
"com.docker.network.driver.overlay.vxlanid_list": "4103",
"encrypted": ""
},
"Labels": null
}
]
After creating a service with a port published in ingress mode:
[
{
"Name": "ingress",
"Id": "yd5qtckhne6p4pxibziqhvy9y",
"Created": "2025-06-06T12:48:30.695590187Z",
"Scope": "swarm",
"Driver": "overlay",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.20.0.0/24",
"Gateway": "172.20.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": true,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"ep-749e32b0fc027a85a3c4c5455c5145562424c29f939a46fa2fc8dae23a54a7d8": {
"Name": "ingress-endpoint",
"EndpointID": "749e32b0fc027a85a3c4c5455c5145562424c29f939a46fa2fc8dae23a54a7d8",
"MacAddress": "02:42:ac:14:00:04",
"IPv4Address": "172.20.0.4/24",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.container_iface_prefix": "ingress",
"com.docker.network.driver.overlay.vxlanid_list": "4103",
"encrypted": ""
},
"Labels": {},
"Peers": [
{
"Name": "8f138b3f965a",
"IP": "192.168.82.13"
},
{
"Name": "08b1511370b2",
"IP": "192.168.82.11"
},
{
"Name": "c56f0eee981c",
"IP": "192.168.82.12"
}
]
}
]
For context, the reason I’m trying to configure the ingress
network as internal
is to prevent internet access for my service.