Add internal DNS server if no custom DNS is set (#45)
Fixes #44 Co-authored-by: Lauris BH <lauris@nix.lv> Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/45 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lafriks@noreply.codeberg.org> Co-committed-by: Lauris BH <lafriks@noreply.codeberg.org>
This commit is contained in:
@@ -209,6 +209,17 @@ func (p *Plugin) writeBuildkitConfig() error {
|
||||
func (p *Plugin) Execute() error {
|
||||
// start the Docker daemon server
|
||||
if !p.settings.Daemon.Disabled {
|
||||
// If no custom DNS value set start internal DNS server
|
||||
if len(p.settings.Daemon.DNS.Value()) == 0 {
|
||||
ip, err := getContainerIP()
|
||||
if err != nil {
|
||||
logrus.Warnf("error detecting IP address: %v", err)
|
||||
} else if ip != "" {
|
||||
p.startCoredns()
|
||||
p.settings.Daemon.DNS.Set(ip)
|
||||
}
|
||||
}
|
||||
|
||||
p.startDaemon()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user