mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
20 lines
443 B
Go
20 lines
443 B
Go
|
package graph
|
||
|
|
||
|
import (
|
||
|
"github.com/docker/docker/engine"
|
||
|
)
|
||
|
|
||
|
func (s *TagStore) CmdTag(job *engine.Job) engine.Status {
|
||
|
if len(job.Args) != 2 && len(job.Args) != 3 {
|
||
|
return job.Errorf("Usage: %s IMAGE REPOSITORY [TAG]\n", job.Name)
|
||
|
}
|
||
|
var tag string
|
||
|
if len(job.Args) == 3 {
|
||
|
tag = job.Args[2]
|
||
|
}
|
||
|
if err := s.Set(job.Args[1], tag, job.Args[0], job.GetenvBool("force")); err != nil {
|
||
|
return job.Error(err)
|
||
|
}
|
||
|
return engine.StatusOK
|
||
|
}
|