diff --git a/builder/dispatchers.go b/builder/dispatchers.go index 201a76ada4..a5313fed4e 100644 --- a/builder/dispatchers.go +++ b/builder/dispatchers.go @@ -166,6 +166,10 @@ func workdir(b *Builder, args []string, attributes map[string]bool) error { // RUN [ "echo", "hi" ] # echo hi // func run(b *Builder, args []string, attributes map[string]bool) error { + if b.image == "" { + return fmt.Errorf("Please provide a source image with `from` prior to run") + } + args = handleJsonArgs(args, attributes) if len(args) == 1 { @@ -174,10 +178,6 @@ func run(b *Builder, args []string, attributes map[string]bool) error { args = append([]string{b.image}, args...) - if b.image == "" { - return fmt.Errorf("Please provide a source image with `from` prior to run") - } - config, _, _, err := runconfig.Parse(args, nil) if err != nil { return err