diff --git a/builder/job.go b/builder/job.go index 1558fa3dab..555232c9ae 100644 --- a/builder/job.go +++ b/builder/job.go @@ -9,6 +9,7 @@ import ( "github.com/docker/docker/daemon" "github.com/docker/docker/engine" + "github.com/docker/docker/graph" "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/parsers" "github.com/docker/docker/registry" @@ -42,7 +43,18 @@ func (b *BuilderJob) CmdBuild(job *engine.Job) engine.Status { ) job.GetenvJson("authConfig", authConfig) job.GetenvJson("configFile", configFile) + repoName, tag = parsers.ParseRepositoryTag(repoName) + if repoName != "" { + if _, _, err := registry.ResolveRepositoryName(repoName); err != nil { + return job.Error(err) + } + if len(tag) > 0 { + if err := graph.ValidateTagName(tag); err != nil { + return job.Error(err) + } + } + } if remoteURL == "" { context = ioutil.NopCloser(job.Stdin)