Skip to content

Commit

Permalink
fix: use image name for run command (#238)
Browse files Browse the repository at this point in the history
The run command shouldn't consume the digest (as it is being created once the image is being pushed to the external registry), because if we do deploy , then build and then run, the run will use image produced by deploy not the subsequent build.

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
  • Loading branch information
zroubalik committed Dec 8, 2020
1 parent 7e47377 commit 985906b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docker/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ func (n *Runner) Run(f faas.Function) error {
return errors.New("please install 'docker'")
}

if f.Image == "" || f.ImageWithDigest() == "" {
return errors.New("Function has no associated Image and Digest. Has it been built?")
if f.Image == "" {
return errors.New("Function has no associated Image. Has it been built?")
}

// Extra arguments to docker
args := []string{"run", "--rm", "-t", "-p=8080:8080"}

for name, value := range f.EnvVars {
if !strings.HasSuffix(name,"-") {
if !strings.HasSuffix(name, "-") {
args = append(args, fmt.Sprintf("-e%s=%s", name, value))
}
}
Expand All @@ -47,7 +47,7 @@ func (n *Runner) Run(f faas.Function) error {
if n.Verbose {
args = append(args, "-e VERBOSE=true")
}
args = append(args, f.ImageWithDigest())
args = append(args, f.Image)

// Set up the command with extra arguments and to run rooted at path
cmd := exec.Command("docker", args...)
Expand Down

0 comments on commit 985906b

Please sign in to comment.