diff --git a/new.go b/new.go index 7b921fb53..d92105f67 100644 --- a/new.go +++ b/new.go @@ -2,6 +2,7 @@ package buildah import ( "fmt" + "strings" "github.com/Sirupsen/logrus" is "github.com/containers/image/storage" @@ -28,7 +29,20 @@ func newBuilder(store storage.Store, options BuilderOptions) (*Builder, error) { name = options.Container } else { if image != "" { - name = image + "-" + name + prefix := image + s := strings.Split(prefix, "/") + if len(s) > 0 { + prefix = s[len(s)-1] + } + s = strings.Split(prefix, ":") + if len(s) > 0 { + prefix = s[0] + } + s = strings.Split(prefix, "@") + if len(s) > 0 { + prefix = s[0] + } + name = prefix + "-" + name } } if name != "" {