forked from TrueCloudLab/distribution
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:
parent
0920d8e1e2
commit
3552960ef8
1 changed files with 8 additions and 0 deletions
|
@ -23,6 +23,7 @@ import (
|
||||||
"github.com/docker/docker/cliconfig"
|
"github.com/docker/docker/cliconfig"
|
||||||
"github.com/docker/docker/pkg/httputils"
|
"github.com/docker/docker/pkg/httputils"
|
||||||
"github.com/docker/docker/pkg/ioutils"
|
"github.com/docker/docker/pkg/ioutils"
|
||||||
|
"github.com/docker/docker/pkg/stringid"
|
||||||
"github.com/docker/docker/pkg/tarsum"
|
"github.com/docker/docker/pkg/tarsum"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -35,6 +36,7 @@ type Session struct {
|
||||||
client *http.Client
|
client *http.Client
|
||||||
// TODO(tiborvass): remove authConfig
|
// TODO(tiborvass): remove authConfig
|
||||||
authConfig *cliconfig.AuthConfig
|
authConfig *cliconfig.AuthConfig
|
||||||
|
id string
|
||||||
}
|
}
|
||||||
|
|
||||||
type authTransport struct {
|
type authTransport struct {
|
||||||
|
@ -158,6 +160,7 @@ func NewSession(client *http.Client, authConfig *cliconfig.AuthConfig, endpoint
|
||||||
authConfig: authConfig,
|
authConfig: authConfig,
|
||||||
client: client,
|
client: client,
|
||||||
indexEndpoint: endpoint,
|
indexEndpoint: endpoint,
|
||||||
|
id: stringid.GenerateRandomID(),
|
||||||
}
|
}
|
||||||
|
|
||||||
var alwaysSetBasicAuth bool
|
var alwaysSetBasicAuth bool
|
||||||
|
@ -188,6 +191,11 @@ func NewSession(client *http.Client, authConfig *cliconfig.AuthConfig, endpoint
|
||||||
return r, nil
|
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.
|
// Retrieve the history of a given image from the Registry.
|
||||||
// Return a list of the parent's json (requested image included)
|
// Return a list of the parent's json (requested image included)
|
||||||
func (r *Session) GetRemoteHistory(imgID, registry string) ([]string, error) {
|
func (r *Session) GetRemoteHistory(imgID, registry string) ([]string, error) {
|
||||||
|
|
Loading…
Reference in a new issue