Fix an issue trying to pull specific tag

This commit is contained in:
Guillaume J. Charmes 2013-05-20 17:30:33 -07:00
Родитель f35f084059
Коммит 49505c599b
2 изменённых файлов: 20 добавлений и 7 удалений

Просмотреть файл

@ -49,7 +49,21 @@ func (b *builderClient) clearTmp(containers, images map[string]struct{}) {
func (b *builderClient) CmdFrom(name string) error {
obj, statusCode, err := b.cli.call("GET", "/images/"+name+"/json", nil)
if statusCode == 404 {
if err := b.cli.hijack("POST", "/images/create?fromImage="+name, false); err != nil {
remote := name
var tag string
if strings.Contains(remote, ":") {
remoteParts := strings.Split(remote, ":")
tag = remoteParts[1]
remote = remoteParts[0]
}
var out io.Writer
if os.Getenv("DEBUG") != "" {
out = os.Stdout
} else {
out = &utils.NopWriter{}
}
if err := b.cli.stream("POST", "/images/create?fromImage="+remote+"&tag="+tag, nil, out); err != nil {
return err
}
obj, _, err = b.cli.call("GET", "/images/"+name+"/json", nil)
@ -233,7 +247,7 @@ func (b *builderClient) commit(id string) error {
}
func (b *builderClient) Build(dockerfile io.Reader) (string, error) {
// defer b.clearTmp(tmpContainers, tmpImages)
defer b.clearTmp(b.tmpContainers, b.tmpImages)
file := bufio.NewReader(dockerfile)
for {
line, err := file.ReadString('\n')

Просмотреть файл

@ -363,7 +363,7 @@ func (srv *Server) pullRepository(out io.Writer, remote, askedTag string) error
for _, img := range repoData.ImgList {
if askedTag != "" && img.Tag != askedTag {
utils.Debugf("%s does not match %s, skipping", img.Tag, askedTag)
utils.Debugf("(%s) does not match %s (id: %s), skipping", img.Tag, askedTag, img.Id)
continue
}
fmt.Fprintf(out, "Pulling image %s (%s) from %s\n", img.Id, img.Tag, remote)
@ -380,11 +380,10 @@ func (srv *Server) pullRepository(out io.Writer, remote, askedTag string) error
return fmt.Errorf("Could not find repository on any of the indexed registries.")
}
}
// If we asked for a specific tag, do not register the others
if askedTag != "" {
return nil
}
for tag, id := range tagsList {
if askedTag != "" && tag != askedTag {
continue
}
if err := srv.runtime.repositories.Set(remote, tag, id, true); err != nil {
return err
}