fix 8926: rmi dangling is unsafe when pulling

Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Ma Shimiao 2015-04-08 10:29:29 +08:00 committed by Tibor Vass
parent 0920d8e1e2
commit 3552960ef8

View file

@ -23,6 +23,7 @@ import (
"github.com/docker/docker/cliconfig"
"github.com/docker/docker/pkg/httputils"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/pkg/tarsum"
)
@ -35,6 +36,7 @@ type Session struct {
client *http.Client
// TODO(tiborvass): remove authConfig
authConfig *cliconfig.AuthConfig
id string
}
type authTransport struct {
@ -158,6 +160,7 @@ func NewSession(client *http.Client, authConfig *cliconfig.AuthConfig, endpoint
authConfig: authConfig,
client: client,
indexEndpoint: endpoint,
id: stringid.GenerateRandomID(),
}
var alwaysSetBasicAuth bool
@ -188,6 +191,11 @@ func NewSession(client *http.Client, authConfig *cliconfig.AuthConfig, endpoint
return r, nil
}
// ID returns this registry session's ID.
func (r *Session) ID() string {
return r.id
}
// Retrieve the history of a given image from the Registry.
// Return a list of the parent's json (requested image included)
func (r *Session) GetRemoteHistory(imgID, registry string) ([]string, error) {