Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 915e34b

Browse files
authored
Merge pull request #233 from carmark/service_rollupdate
avoid pulling image while service's rolling update
2 parents fdb44d8 + 0246b74 commit 915e34b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

api/client/cron.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func (cli *DockerCli) CmdCronCreate(args ...string) error {
103103
entrypoint = strslice.StrSlice{*flEntrypoint}
104104
}
105105

106-
if _, _, err = cli.client.ImageInspectWithRaw(context.Background(), image, false); err != nil {
106+
if _, _, err = cli.client.ImageInspectWithRaw(context.Background(), image, false); err != nil && strings.Contains(err.Error(), "No such image") {
107107
if err := cli.pullImage(context.Background(), image); err != nil {
108108
return err
109109
}

api/client/service.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func (cli *DockerCli) CmdServiceCreate(args ...string) error {
9090
image = cmd.Arg(0)
9191
)
9292

93-
if _, _, err = cli.client.ImageInspectWithRaw(context.Background(), image, false); err != nil {
93+
if _, _, err = cli.client.ImageInspectWithRaw(context.Background(), image, false); err != nil && strings.Contains(err.Error(), "No such image") {
9494
if err := cli.pullImage(context.Background(), image); err != nil {
9595
return err
9696
}
@@ -319,8 +319,10 @@ func (cli *DockerCli) CmdServiceRolling_update(args ...string) error {
319319
}
320320

321321
ctx := context.Background()
322-
if err := cli.pullImage(ctx, *flImage); err != nil {
323-
return err
322+
if _, _, err := cli.client.ImageInspectWithRaw(ctx, *flImage, false); err != nil && strings.Contains(err.Error(), "No such image") {
323+
if err := cli.pullImage(ctx, *flImage); err != nil {
324+
return err
325+
}
324326
}
325327

326328
for _, sr := range cmd.Args() {

0 commit comments

Comments
 (0)