diff --git a/dispatchers.go b/dispatchers.go index 1d77a193b..6a7f26880 100644 --- a/dispatchers.go +++ b/dispatchers.go @@ -186,6 +186,20 @@ func dispatchCopy(b *Builder, args []string, attributes map[string]bool, flagArg if err != nil { return err } + // If there's an arg ending with an '=', it's likely we did + // not resolve a variable value from the Environment Variables. + // Let's see if the variable was defined in an 'ARG' statement + // in the Dockerfile. + if strings.HasSuffix(arg, "=") { + var userArg []string + for key, value := range b.Args { + userArg = append(userArg, key+"="+value) + } + arg, err = ProcessWord(a, userArg) + if err != nil { + return err + } + } switch { case strings.HasPrefix(arg, "--chown="): chown = strings.TrimPrefix(arg, "--chown=")