8000 "docker rmi -f" is stuck · Issue #39739 · moby/moby · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
"docker rmi -f" is stuck #39739
Closed
Closed
@yanghaichao12

Description

@yanghaichao12

What happened:
my execution “docker rmi -f imageXXX” is stuck when some other container in the same host has connected to an abnormal nfs server, and i'm very sure there's no any container using this imageXXX at time.

i notice:

65DF
if mask&conflictRunningContainer != 0 {
// Check if any running container is using the image.
running := func(c *container.Container) bool {
return c.IsRunning() && c.ImageID == imgID
}
if container := i.containers.First(running); container != nil {
return &imageDeleteConflict{
imgID: imgID,
hard: true,
used: true,
message: fmt.Sprintf("image is being used by running container %s", stringid.TruncateID(container.ID)),
}
}
}

here, all containers will be checked if running and then if the containter being checked has the identical imageid to the deleting imgid .

moby/container/state.go

Lines 239 to 244 in fade624

func (s *State) IsRunning() bool {
s.Lock()
res := s.Running
s.Unlock()
return res
}

and there is global lock. That's the reason. i think maybe adjusting the statement like that will be better:

return  c.ImageID == imgID && c.IsRunning()

What you expected to happen:
no stuck when running docker rmi .
How to reproduce it (as minimally and precisely as possible):
1.mount some containers to nfs server.
2.make nfs server unaccessible.
3.docker rmi any container.
Environment:

version:
any version
Cloud provider or hardware configuration:
OS (e.g: cat /etc/os-release): Ubuntu 16.04 LTS
Kernel (e.g. uname -a):4.4.0-21-generic #37-Ubuntu
Install tools:
Network plugin and version (if this is a network-related bug):
Others:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0