Skip to content

Commit 9f76d80

Browse files
committed
Fix bosh dns under systemd
The old apprach was turning off systemd's resolution configuration
1 parent b9d6160 commit 9f76d80

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/bosh-docker-cpi/vm/factory.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ func (f Factory) Create(agentID apiv1.AgentID, stemcell bstem.Stemcell,
103103
// BOSH agent takes over.
104104
preStartCommands := []string{
105105
`umount /etc/resolv.conf`,
106-
populateResolveConf(networks),
107106
`umount /etc/hosts`,
108107
`umount /etc/hostname`,
109108
networkInitBashCmd,
@@ -135,14 +134,15 @@ func (f Factory) Create(agentID apiv1.AgentID, stemcell bstem.Stemcell,
135134
}, " ")
136135

137136
preStartCommands = append(preStartCommands, []string{
137+
`ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf`,
138138
`rm -rf /etc/sv/{ssh,cron}`,
139139
`rm -rf /etc/service/{ssh,cron}`,
140140
deleteUnwantedUnitsCommand,
141141
}...)
142142

143143
startContainerCommands = append(preStartCommands, `exec /sbin/init`)
144144
} else {
145-
preStartCommands = append(preStartCommands, []string{}...)
145+
preStartCommands = append(preStartCommands, []string{populateResolveConf(networks)}...)
146146

147147
startContainerCommands = append(preStartCommands, `exec env -i /usr/sbin/runsvdir-start`)
148148
}

0 commit comments

Comments
 (0)