1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #23790 from tonistiigi/skip-pull

Skip always pulling images on integration tests
This commit is contained in:
Tõnis Tiigi 2016-06-23 11:47:33 -07:00 committed by GitHub
commit 487931902c
2 changed files with 17 additions and 14 deletions

View file

@ -2,6 +2,7 @@ package container
import ( import (
"fmt" "fmt"
"os"
executorpkg "github.com/docker/docker/daemon/cluster/executor" executorpkg "github.com/docker/docker/daemon/cluster/executor"
"github.com/docker/engine-api/types" "github.com/docker/engine-api/types"
@ -84,19 +85,21 @@ func (r *controller) Prepare(ctx context.Context) error {
return err return err
} }
if err := r.adapter.pullImage(ctx); err != nil { if os.Getenv("DOCKER_SERVICE_PREFER_OFFLINE_IMAGE") != "1" {
// NOTE(stevvooe): We always try to pull the image to make sure we have if err := r.adapter.pullImage(ctx); err != nil {
// the most up to date version. This will return an error, but we only // NOTE(stevvooe): We always try to pull the image to make sure we have
// log it. If the image truly doesn't exist, the create below will // the most up to date version. This will return an error, but we only
// error out. // log it. If the image truly doesn't exist, the create below will
// // error out.
// This gives us some nice behavior where we use up to date versions of //
// mutable tags, but will still run if the old image is available but a // This gives us some nice behavior where we use up to date versions of
// registry is down. // mutable tags, but will still run if the old image is available but a
// // registry is down.
// If you don't want this behavior, lock down your image to an //
// immutable tag or digest. // If you don't want this behavior, lock down your image to an
log.G(ctx).WithError(err).Error("pulling image failed") // immutable tag or digest.
log.G(ctx).WithError(err).Error("pulling image failed")
}
} }
if err := r.adapter.create(ctx, r.backend); err != nil { if err := r.adapter.create(ctx, r.backend); err != nil {

View file

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