Skip to content

Commit 0065931

Browse files
committed
feat: If the container exists, no pull is performed to speed up program execution
1 parent ea37068 commit 0065931

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sandbox/sandbox.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,10 @@ func main() {
143143
log.Printf("Running in dev mode; container published to host at: http://localhost:8080/")
144144
log.Printf("Run a binary with: curl -v --data-binary @/home/bradfitz/hello http://localhost:8080/run\n")
145145
} else {
146-
if out, err := exec.Command("docker", "pull", *container).CombinedOutput(); err != nil {
147-
log.Fatalf("error pulling %s: %v, %s", *container, err, out)
146+
if _, err := exec.Command("docker", "images", "-q", *container).CombinedOutput(); err != nil {
147+
if out, err := exec.Command("docker", "pull", *container).CombinedOutput(); err != nil {
148+
log.Fatalf("error pulling %s: %v, %s", *container, err, out)
149+
}
148150
}
149151
log.Printf("Listening on %s", *listenAddr)
150152
}

0 commit comments

Comments
 (0)