Skip to content

Commit 985906b

Browse files
authored
fix: use image name for run command (#238)
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>
1 parent 7e47377 commit 985906b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docker/runner.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ func (n *Runner) Run(f faas.Function) error {
3030
return errors.New("please install 'docker'")
3131
}
3232

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

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

4040
for name, value := range f.EnvVars {
41-
if !strings.HasSuffix(name,"-") {
41+
if !strings.HasSuffix(name, "-") {
4242
args = append(args, fmt.Sprintf("-e%s=%s", name, value))
4343
}
4444
}
@@ -47,7 +47,7 @@ func (n *Runner) Run(f faas.Function) error {
4747
if n.Verbose {
4848
args = append(args, "-e VERBOSE=true")
4949
}
50-
args = append(args, f.ImageWithDigest())
50+
args = append(args, f.Image)
5151

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

0 commit comments

Comments
 (0)