@@ -81,6 +81,9 @@ func (c Controller) ContainerRun(
8181 unitTestFailure bool ,
8282) string {
8383 hostConfig := & container.HostConfig {
84+ // On Linux Docker Engine, host.docker.internal is not set by default
85+ // (Docker Desktop sets it automatically). Add it so containers can
86+ // reach host services, e.g. for bak-file restore from a local HTTP server.
8487 ExtraHosts : []string {"host.docker.internal:host-gateway" },
8588 PortBindings : network.PortMap {
8689 network .MustParsePort ("1433/tcp" ): []network.PortBinding {
@@ -251,15 +254,18 @@ func (c Controller) DownloadFile(id string, src string, destFolder string) {
251254 panic ("Must pass in non-empty destFolder" )
252255 }
253256
254- cmd := []string {"mkdir" , "-p" , destFolder }
255- c .runCmdInContainer (id , cmd )
256-
257257 _ , file := filepath .Split (src )
258258 if file == "" {
259259 panic ("src URL has no filename: " + src )
260260 }
261261 dest := destFolder + "/" + file // not using filepath.Join here, this is in the *nix container. always /
262262
263+ cmd := []string {"mkdir" , "-p" , destFolder }
264+ _ , _ , mkdirExit := c .runCmdInContainer (id , cmd )
265+ if mkdirExit != 0 {
266+ panic ("mkdir failed for " + destFolder )
267+ }
268+
263269 cmd = []string {"wget" , "-O" , dest , src }
264270 _ , stderr , exitCode := c .runCmdInContainer (id , cmd )
265271 if exitCode != 0 {
@@ -313,6 +319,9 @@ func (c Controller) runCmdInContainer(id string, cmd []string) ([]byte, []byte,
313319 trace ("Stdout: " + string (stdout ))
314320 trace ("Stderr: " + string (stderr ))
315321
322+ // ExecInspect may rarely return Running:true after output is drained
323+ // (moby/moby#42408). In practice the race window is negligible for
324+ // short-lived commands like mkdir and wget.
316325 inspect , err := c .cli .ExecInspect (
317326 context .Background (),
318327 response .ID ,
0 commit comments