Skip always pulling images on integration tests

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit e2226223e614716749cdb7701a130c7449f5f854)
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tonis Tiigi 2016-06-20 17:44:45 -07:00 committed by Tibor Vass
parent 236317fa56
commit 13e82f23c8
2 changed files with 34 additions and 31 deletions

View File

@ -2,6 +2,7 @@ package container
import (
"fmt"
"os"
executorpkg "github.com/docker/docker/daemon/cluster/executor"
"github.com/docker/engine-api/types"
@ -89,6 +90,7 @@ func (r *controller) Prepare(ctx context.Context) error {
return err
}
if os.Getenv("DOCKER_SERVICE_PREFER_OFFLINE_IMAGE") != "1" {
if r.pulled == nil {
// Fork the pull to a different context to allow pull to continue
// on re-entrant calls to Prepare. This ensures that Prepare can be
@ -124,6 +126,7 @@ func (r *controller) Prepare(ctx context.Context) error {
log.G(ctx).WithError(r.pullErr).Error("pulling image failed")
}
}
}
if err := r.adapter.create(ctx, r.backend); err != nil {
if isContainerCreateNameConflict(err) {

View File

@ -172,7 +172,7 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error {
args = append(args, providedArgs...)
d.cmd = exec.Command(dockerdBinary, args...)
d.cmd.Env = append(os.Environ(), "DOCKER_SERVICE_PREFER_OFFLINE_IMAGE=1")
d.cmd.Stdout = out
d.cmd.Stderr = out
d.logFile = out