mirror of https://github.com/docker/docs.git
fix
This commit is contained in:
parent
db1e965b65
commit
f01990aad2
|
@ -717,10 +717,11 @@ func (srv *Server) ImageDelete(name string) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// check if the image is referenced in another repo (base and user/base are the same, docker rmi user/base)
|
// Let's say you have the same image referenced by base and base2
|
||||||
|
// check if the image is referenced in another repo (docker rmi base)
|
||||||
for _, repoTag := range srv.runtime.repositories.ById()[img.Id] {
|
for _, repoTag := range srv.runtime.repositories.ById()[img.Id] {
|
||||||
if !strings.Contains(repoTag, name+":") {
|
if !strings.HasPrefix(repoTag, name+":") {
|
||||||
// if found in another repo, delete the repo, otherwie delete the whole image (docker rmi base)
|
// if found in another repo (base2) delete the repo base, otherwise delete the whole image
|
||||||
if err := srv.runtime.repositories.Delete(name, "", img.Id); err != nil {
|
if err := srv.runtime.repositories.Delete(name, "", img.Id); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue