@@ -180,13 +180,19 @@ func attachServiceContainer(tenantName, networkName string, stateDriver core.Sta
180
180
"Continuing without DNS provider. Error: %v" , err )
181
181
return nil
182
182
}
183
+ cinfo , err = docker .InspectContainer (contName )
184
+ if err != nil {
185
+ log .Warnf ("Error fetching container info after starting %s" +
186
+ "Continuing without DNS provider. Error: %s" , contName , err )
187
+ return nil
188
+ }
183
189
}
184
190
}
185
191
186
192
// If it's not in running state, restart the container.
187
193
// This case can occur if the host is reloaded
188
194
if ! cinfo .State .Running {
189
- log .Debugf ("Container %s not running. Restarting the conttainer " , contName )
195
+ log .Debugf ("Container %s not running. Restarting the container " , contName )
190
196
err = docker .RestartContainer (contName , 0 )
191
197
if err != nil {
192
198
log .Warnf ("Error restarting service container %s. " +
@@ -197,6 +203,11 @@ func attachServiceContainer(tenantName, networkName string, stateDriver core.Sta
197
203
198
204
// Refetch container info after restart
199
205
cinfo , err = docker .InspectContainer (contName )
206
+ if err != nil {
207
+ log .Warnf ("Error fetching container info after restarting %s" +
208
+ "Continuing without DNS provider. Error: %s" , contName , err )
209
+ return nil
210
+ }
200
211
}
201
212
202
213
log .Debugf ("Container info: %+v\n Hostconfig: %+v" , cinfo , cinfo .HostConfig )
@@ -207,7 +218,7 @@ func attachServiceContainer(tenantName, networkName string, stateDriver core.Sta
207
218
err = docker .ConnectNetwork (dnetName , contName )
208
219
if err != nil {
209
220
log .Warnf ("Could not attach container(%s) to network %s. " +
210
- "Continuing with DNS provider. Error: %s" ,
221
+ "Continuing without DNS provider. Error: %s" ,
211
222
contName , dnetName , err )
212
223
return nil
213
224
}
0 commit comments