[GH-ISSUE #165] Container can't restart if config.json file is maintained #67

Closed
opened 2026-02-26 04:33:57 +03:00 by kerem · 3 comments
Owner

Originally created by @imartinezortiz on GitHub (Oct 18, 2019).
Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/165

Originally assigned to: @mageddo on GitHub.

What is Happening

  • Describe what is happening instead

Container can't restart (or a new one created) if the conf/config.json sets LogLevel parameter, the config file is reused between restarts (e.g. bind mount) and the config file is changed during runtime, for example, by adding a DNS entry (DPS writes the config file).

Seems that github.com/mageddo/dns-proxy-server@e380797f3e introduced the bug,

func ValueOf(c *localvo.Configuration) *ConfigurationV2 {
	return &ConfigurationV2{
		Version:                int64(2),
		LogFile:                c.LogFile,
		ActiveEnv:              c.ActiveEnv,
		DefaultDns:             c.DefaultDns,
		DnsServerPort:          c.DnsServerPort,
		Domain:                 c.Domain,
		HostMachineHostname:    c.HostMachineHostname,
		**LogLevel:               c.LogFile,**

What is expected

The container should restart without issues or a new container could be created reusing the config file.

Steps to Reproduce

cat << EOF > config.json
{
        "version": 2,
        "remoteDnsServers": [],
        "envs": [
                {
                        "name": ""
                }
        ],
        "activeEnv": "",
        "webServerPort": 0,
        "dnsServerPort": 0,
        "defaultDns": null,
        "logLevel": "DEBUG",
        "logFile": "console",
        "registerContainerNames": null,
        "hostMachineHostname": "",
        "domain": "",
        "dpsNetwork": false,
        "dpsNetworkAutoConnect": false
}
EOF

docker run --name dps -v $PWD/config.json:/app/conf/config.json -d -p 5390:5380 defreitas/dns-proxy-server:2.18.1

# Add a DNS entry using the UI

docker stop dps

docker start dps

# container Exited

docker logs dps &> dps.log
docker cp dps:/app/conf/config.json config-wrong.json.txt

dps.log
config-wrong.json.txt

Specs:

  • OS: Ubuntu 16.04.2
  • Docker Version: 19.03.3
  • DPS Version: 2.18.1
  • Please attach DPS Log file
Originally created by @imartinezortiz on GitHub (Oct 18, 2019). Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/165 Originally assigned to: @mageddo on GitHub. ### What is Happening * Describe what is happening instead Container can't restart (or a new one created) if the conf/config.json sets LogLevel parameter, the config file is reused between restarts (e.g. bind mount) and the config file is changed during runtime, for example, by adding a DNS entry (DPS writes the config file). Seems that https://github.com/mageddo/dns-proxy-server/commit/e380797f3eb3560e5b41b3e08e12e63c41c23d22 introduced the bug, ``` func ValueOf(c *localvo.Configuration) *ConfigurationV2 { return &ConfigurationV2{ Version: int64(2), LogFile: c.LogFile, ActiveEnv: c.ActiveEnv, DefaultDns: c.DefaultDns, DnsServerPort: c.DnsServerPort, Domain: c.Domain, HostMachineHostname: c.HostMachineHostname, **LogLevel: c.LogFile,** ``` ### What is expected The container should restart without issues or a new container could be created reusing the config file. ### Steps to Reproduce ``` cat << EOF > config.json { "version": 2, "remoteDnsServers": [], "envs": [ { "name": "" } ], "activeEnv": "", "webServerPort": 0, "dnsServerPort": 0, "defaultDns": null, "logLevel": "DEBUG", "logFile": "console", "registerContainerNames": null, "hostMachineHostname": "", "domain": "", "dpsNetwork": false, "dpsNetworkAutoConnect": false } EOF docker run --name dps -v $PWD/config.json:/app/conf/config.json -d -p 5390:5380 defreitas/dns-proxy-server:2.18.1 # Add a DNS entry using the UI docker stop dps docker start dps # container Exited docker logs dps &> dps.log docker cp dps:/app/conf/config.json config-wrong.json.txt ``` [dps.log](https://github.com/mageddo/dns-proxy-server/files/3743438/dps.log) [config-wrong.json.txt](https://github.com/mageddo/dns-proxy-server/files/3743440/config-wrong.json.txt) **Specs:** - OS: Ubuntu 16.04.2 - Docker Version: 19.03.3 - DPS Version: 2.18.1 - Please attach DPS Log file
kerem 2026-02-26 04:33:57 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@mageddo commented on GitHub (Nov 3, 2019):

@imartinezortiz thanks for the contribution, it appears the bug is at this point

Fixing on #168

<!-- gh-comment-id:549133876 --> @mageddo commented on GitHub (Nov 3, 2019): @imartinezortiz thanks for the contribution, it appears the bug is [at this point](https://github.com/mageddo/dns-proxy-server/commit/e380797f3eb3560e5b41b3e08e12e63c41c23d22#diff-d458d7f6dd9cd9153f56ec0aa76be254R57) Fixing on #168
Author
Owner

@mageddo commented on GitHub (Nov 3, 2019):

Please re open if don't work for you

<!-- gh-comment-id:549135769 --> @mageddo commented on GitHub (Nov 3, 2019): Please re open if don't work for you
Author
Owner

@imartinezortiz commented on GitHub (Nov 4, 2019):

Thanks !, I can confirm that 2.18.2 docker image fix the problem.

<!-- gh-comment-id:549316571 --> @imartinezortiz commented on GitHub (Nov 4, 2019): Thanks !, I can confirm that 2.18.2 docker image fix the problem.
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#67
No description provided.