Set DNS per container rather than the daemon

All Cloudron containers need to have the nameserver 172.18.0.1. This was
being done at the daemon level, however since there are also iptables
rules restricting access to the nameserver from containers that aren't
on the Cloudron Docker network, this broke DNS for non-Cloudron
containers.

Since the DNS is only required for Cloudron containers in the first
place, this patch specifies 172.18.0.1 as the nameserver when Cloudron
creates a container and reverts the change at the daemon level
This commit is contained in:
Ian Fijolek
2017-04-20 17:02:28 +00:00
parent 788873e858
commit 9dd51575ab
2 changed files with 2 additions and 1 deletions

View File

@@ -203,6 +203,7 @@ function createSubcontainer(app, name, cmd, options, callback) {
CpuShares: 512, // relative to 1024 for system processes
VolumesFrom: isAppContainer ? null : [ app.containerId + ":rw" ],
NetworkMode: isAppContainer ? 'cloudron' : ('container:' + app.containerId), // share network namespace with parent
Dns: ['172.18.0.1'], // use internal dns
SecurityOpt: enableSecurityOpt ? [ "apparmor:docker-cloudron-app" ] : null // profile available only on cloudron
}
};