Browse code

UPSTREAM: openshift/imagebuilder: <drop>: Handle Docker 1.12

Clayton Coleman authored on 2016/11/04 11:09:15
Showing 1 changed files
... ...
@@ -228,7 +228,12 @@ func (e *ClientExecutor) Build(r io.Reader, args map[string]string) error {
228 228
 			)
229 229
 		}
230 230
 
231
-		if err := e.Client.StartContainer(e.Container.ID, &hostConfig); err != nil {
231
+		hc := &hostConfig
232
+		if len(hostConfig.Binds) == 0 {
233
+			// don't set HostConfig if we have no need for binds
234
+			hc = nil
235
+		}
236
+		if err := e.Client.StartContainer(e.Container.ID, hc); err != nil {
232 237
 			return fmt.Errorf("unable to start build container: %v", err)
233 238
 		}
234 239
 		// TODO: is this racy? may have to loop wait in the actual run step