[GH-ISSUE #631] Docker Adapter Provider DpsContainerDAODefault doesn't use a proper IP address range #212

Closed
opened 2026-02-26 04:34:24 +03:00 by kerem · 2 comments
Owner

Originally created by @amueller2504 on GitHub (Sep 14, 2025).
Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/631

Currently the docker adapter provider DpsContainerDAODefault uses an IMHO invalid IP address range.

github.com/mageddo/dns-proxy-server@9c26699337/src/main/java/com/mageddo/dnsproxyserver/solver/docker/dataprovider/DpsContainerDAODefault.java (L86)

During the start up of the dns proxy server I see the following error message in the logs:

12:48:28.416 [main           ] ERR com.mageddo.dnsproxyserver.App                    l=40   m=start                           status=fatalError, action=exit, msg=BadRequestException: Status 400: {"message":"invalid network config:\ninvalid ip-range 172.157.5.3/24: it should be 172.157.5.0/24"}
, class=BadRequestException
com.github.dockerjava.api.exception.BadRequestException: Status 400: {"message":"invalid network config:\ninvalid ip-range 172.157.5.3/24: it should be 172.157.5.0/24"}

	at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:237)
	at com.github.dockerjava.core.DefaultInvocationBuilder.post(DefaultInvocationBuilder.java:124)
	at com.github.dockerjava.core.exec.CreateNetworkCmdExec.execute(CreateNetworkCmdExec.java:27)
	at com.github.dockerjava.core.exec.CreateNetworkCmdExec.execute(CreateNetworkCmdExec.java:12)
	at com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
	at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:33)
	at com.mageddo.dnsproxyserver.solver.docker.dataprovider.DpsContainerDAODefault.createDpsNetwork(DpsContainerDAODefault.java:77)
	at com.mageddo.dnsproxyserver.solver.docker.application.DpsDockerEnvironmentSetupService.createNetworkIfAbsent(DpsDockerEnvironmentSetupService.java:61)
	at com.mageddo.dnsproxyserver.solver.docker.application.DpsDockerEnvironmentSetupService.setupNetwork(DpsDockerEnvironmentSetupService.java:48)
	at com.mageddo.dnsproxyserver.solver.docker.application.DpsDockerEnvironmentSetupService.setup(DpsDockerEnvironmentSetupService.java:37)
	at com.mageddo.dnsproxyserver.solver.docker.entrypoint.EventListener.onStart(EventListener.java:31)
	at java.base@21.0.2/java.lang.Iterable.forEach(Iterable.java:75)
	at java.base@21.0.2/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1116)
	at com.mageddo.dnsproxyserver.server.Starter.start(Starter.java:30)
	at com.mageddo.dnsproxyserver.di.Context.start(Context.java:64)
	at com.mageddo.dnsproxyserver.App.startContext(App.java:86)
	at com.mageddo.dnsproxyserver.App.mustStart(App.java:61)
	at com.mageddo.dnsproxyserver.App.start(App.java:36)
	at com.mageddo.dnsproxyserver.App.main(App.java:30)
	at java.base@21.0.2/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

I am running the docker container with:

docker run --hostname dns.docker --restart=unless-stopped -d --name=docker-dns \
  -p 5354:53/tcp \
  -p 5354:53/udp \
  -p 5380:5380 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /opt/dns-proxy-server/conf:/app/conf \
 defreitas/dns-proxy-server:3.32.4

And having the following basic config:

{
	"version": 2,
	"remoteDnsServers": [],
	"envs": [
		{
			"name": ""
		}
	],
	"activeEnv": "",
	"webServerPort": 0,
	"dnsServerPort": 0,
	"defaultDns": null,
	"logLevel": "TRACE",
	"logFile": "console",
	"registerContainerNames": null,
	"hostMachineHostname": "host.docker",
	"domain": "docker",
	"dpsNetwork": true,
	"dpsNetworkAutoConnect": true
}

Wouldn't it be better to make these settings configurable?

Originally created by @amueller2504 on GitHub (Sep 14, 2025). Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/631 Currently the docker adapter provider `DpsContainerDAODefault` uses an IMHO invalid IP address range. https://github.com/mageddo/dns-proxy-server/blob/9c26699337a1008d37474978c02ea0ea733083f6/src/main/java/com/mageddo/dnsproxyserver/solver/docker/dataprovider/DpsContainerDAODefault.java#L86 During the start up of the dns proxy server I see the following error message in the logs: ``` 12:48:28.416 [main ] ERR com.mageddo.dnsproxyserver.App l=40 m=start status=fatalError, action=exit, msg=BadRequestException: Status 400: {"message":"invalid network config:\ninvalid ip-range 172.157.5.3/24: it should be 172.157.5.0/24"} , class=BadRequestException com.github.dockerjava.api.exception.BadRequestException: Status 400: {"message":"invalid network config:\ninvalid ip-range 172.157.5.3/24: it should be 172.157.5.0/24"} at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:237) at com.github.dockerjava.core.DefaultInvocationBuilder.post(DefaultInvocationBuilder.java:124) at com.github.dockerjava.core.exec.CreateNetworkCmdExec.execute(CreateNetworkCmdExec.java:27) at com.github.dockerjava.core.exec.CreateNetworkCmdExec.execute(CreateNetworkCmdExec.java:12) at com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21) at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:33) at com.mageddo.dnsproxyserver.solver.docker.dataprovider.DpsContainerDAODefault.createDpsNetwork(DpsContainerDAODefault.java:77) at com.mageddo.dnsproxyserver.solver.docker.application.DpsDockerEnvironmentSetupService.createNetworkIfAbsent(DpsDockerEnvironmentSetupService.java:61) at com.mageddo.dnsproxyserver.solver.docker.application.DpsDockerEnvironmentSetupService.setupNetwork(DpsDockerEnvironmentSetupService.java:48) at com.mageddo.dnsproxyserver.solver.docker.application.DpsDockerEnvironmentSetupService.setup(DpsDockerEnvironmentSetupService.java:37) at com.mageddo.dnsproxyserver.solver.docker.entrypoint.EventListener.onStart(EventListener.java:31) at java.base@21.0.2/java.lang.Iterable.forEach(Iterable.java:75) at java.base@21.0.2/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1116) at com.mageddo.dnsproxyserver.server.Starter.start(Starter.java:30) at com.mageddo.dnsproxyserver.di.Context.start(Context.java:64) at com.mageddo.dnsproxyserver.App.startContext(App.java:86) at com.mageddo.dnsproxyserver.App.mustStart(App.java:61) at com.mageddo.dnsproxyserver.App.start(App.java:36) at com.mageddo.dnsproxyserver.App.main(App.java:30) at java.base@21.0.2/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH) ``` I am running the docker container with: ``` docker run --hostname dns.docker --restart=unless-stopped -d --name=docker-dns \ -p 5354:53/tcp \ -p 5354:53/udp \ -p 5380:5380 \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /opt/dns-proxy-server/conf:/app/conf \ defreitas/dns-proxy-server:3.32.4 ``` And having the following basic config: ```json { "version": 2, "remoteDnsServers": [], "envs": [ { "name": "" } ], "activeEnv": "", "webServerPort": 0, "dnsServerPort": 0, "defaultDns": null, "logLevel": "TRACE", "logFile": "console", "registerContainerNames": null, "hostMachineHostname": "host.docker", "domain": "docker", "dpsNetwork": true, "dpsNetworkAutoConnect": true } ``` Wouldn't it be better to make these settings configurable?
kerem closed this issue 2026-02-26 04:34:24 +03:00
Author
Owner

@mageddo commented on GitHub (Sep 22, 2025):

Hey, thanks for your report.

{"message":"invalid network config:\ninvalid ip-range 172.157.5.3/24: it should be 172.157.5.0/24"}

If docker says it's a invalid range, then let's change it.

Wouldn't it be better to make these settings configurable?

Totally agree, but currently the way to provide a new customizable setting is pretty boring, by this reason I'm working on #594

I expect to get #594 done shortly, then will add that setting.

<!-- gh-comment-id:3320568213 --> @mageddo commented on GitHub (Sep 22, 2025): Hey, thanks for your report. > {"message":"invalid network config:\ninvalid ip-range 172.157.5.3/24: it should be 172.157.5.0/24"} If docker says it's a invalid range, then let's change it. > Wouldn't it be better to make these settings configurable? Totally agree, but currently the way to provide a new customizable setting is pretty boring, by this reason I'm working on #594 I expect to get #594 done shortly, then will add that setting.
Author
Owner

@mageddo commented on GitHub (Dec 17, 2025):

Beta is out, see the docs 5.2.0

<!-- gh-comment-id:3667319645 --> @mageddo commented on GitHub (Dec 17, 2025): Beta is out, see the docs [5.2.0](https://mageddo.github.io/dns-proxy-server/5.2/en/3-configuration/#docker-solver)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/dns-proxy-server-mageddo#212
No description provided.