New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot stop container XXXXXXXXXXXX: [2] Container does not exist: container destroyed #12738
Comments
I've got this error when I use docker remote api v1.17 and docker 1.6
docker logs:
|
👍 |
2 similar comments
👍 |
👍 |
😒 |
can you provide some steps to reproduce this? |
👍 |
Happened to me today |
👍 |
@icecrime Can you get this prioritized? I also see that the old process is still around, so this looks like a new 'ghost container' issue. |
We have also been hitting this issue. I'm trying to narrow down steps to reproduce. |
If someone can reproduce this in a VM and snapshot the VM that'd be really fantastic, these are bugs that are hard to reproduce :( |
reproducible with
|
The reproduction case seems to imply a race condition, but then, this only happen if you issue @discordianfish Could you tell us more about the way this happened for you? In particular: is there a chance that the container process died at the same time that you issued the |
@icecrime No sorry, I don't have more details. I found those systems in that state and some containers were running according to docker ps but couldn't be stopped. Additionally to that, I saw older processes still running. Beside that, it looks like we have no 'stress tests' in the docker test suite which would have caught that issue. As @LK4D4 shows, at least some race condition is easily found by this simple test. |
Happened to me since 1.6.0 upgrade : $ docker rm -f 46f4675d50c1
Error response from daemon: Could not kill running container, cannot remove - [2] Container does not exist: container destroyed
FATA[0000] Error: failed to remove one or more containers
$ docker inspect 46f4675d50c1
[{
"AppArmorProfile": "",
"Args": [
"-c",
"/config/loop"
],
"Config": {
"AttachStderr": true,
"AttachStdin": false,
"AttachStdout": true,
"Cmd": [
"/bin/sh",
"-c",
"/config/loop"
],
"CpuShares": 0,
"Cpuset": "",
"Domainname": "",
"Entrypoint": null,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"DEBIAN_FRONTEND=noninteractive",
"ROADIZ_BRANCH=master"
],
"ExposedPorts": {
"80/tcp": {}
},
"Hostname": "46f4675d50c1",
"Image": "roadiz/roadiz",
"Labels": null,
"MacAddress": "",
"Memory": 0,
"MemorySwap": 0,
"NetworkDisabled": false,
"OnBuild": null,
"OpenStdin": false,
"PortSpecs": null,
"StdinOnce": false,
"Tty": true,
"User": "",
"Volumes": null,
"WorkingDir": ""
},
"Created": "2015-04-27T21:54:17.310271095Z",
"Driver": "aufs",
"ExecDriver": "native-0.2",
"ExecIDs": [
"55c474e453bff882f08f6074a3974d50321add4b039cdb99ac7462acc3f66b08"
],
"HostConfig": {
"Binds": null,
"CapAdd": null,
"CapDrop": null,
"CgroupParent": "",
"ContainerIDFile": "",
"CpuShares": 0,
"CpusetCpus": "",
"Devices": null,
"Dns": null,
"DnsSearch": null,
"ExtraHosts": null,
"IpcMode": "",
"Links": [
"/mariadb:/roadiz/mariadb"
],
"LogConfig": {
"Config": null,
"Type": "json-file"
},
"LxcConf": [],
"Memory": 0,
"MemorySwap": 0,
"NetworkMode": "bridge",
"PidMode": "",
"PortBindings": {
"80/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "49153"
}
]
},
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"RestartPolicy": {
"MaximumRetryCount": 0,
"Name": ""
},
"SecurityOpt": null,
"Ulimits": null,
"VolumesFrom": [
"data-roadiz"
]
},
"HostnamePath": "/var/lib/docker/containers/46f4675d50c13ac965fcd420cc15d63a2338e64820d62d474f468ac1ecd6ac0d/hostname",
"HostsPath": "/var/lib/docker/containers/46f4675d50c13ac965fcd420cc15d63a2338e64820d62d474f468ac1ecd6ac0d/hosts",
"Id": "46f4675d50c13ac965fcd420cc15d63a2338e64820d62d474f468ac1ecd6ac0d",
"Image": "bc28093328c52de86f698f654f0926ca897c2a4ff95ebc768f1337bec4a42965",
"LogPath": "/var/lib/docker/containers/46f4675d50c13ac965fcd420cc15d63a2338e64820d62d474f468ac1ecd6ac0d/46f4675d50c13ac965fcd420cc15d63a2338e64820d62d474f468ac1ecd6ac0d-json.log",
"MountLabel": "",
"Name": "/roadiz",
"NetworkSettings": {
"Bridge": "docker0",
"Gateway": "172.17.42.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.4",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"LinkLocalIPv6Address": "fe80::42:acff:fe11:4",
"LinkLocalIPv6PrefixLen": 64,
"MacAddress": "02:42:ac:11:00:04",
"PortMapping": null,
"Ports": {
"80/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "49153"
}
]
}
},
"Path": "/bin/sh",
"ProcessLabel": "",
"ResolvConfPath": "/etc/resolv.conf",
"RestartCount": 0,
"State": {
"Dead": false,
"Error": "",
"ExitCode": 0,
"FinishedAt": "2015-05-02T00:17:33.063361405Z",
"OOMKilled": false,
"Paused": false,
"Pid": 16345,
"Restarting": false,
"Running": true,
"StartedAt": "2015-05-02T00:23:43.684876553Z"
},
"Volumes": {
"/data": "/var/lib/docker/vfs/dir/09b9b1dab4a8f6e4ad7e2d6651a794e94d154e3618acc8a43b339489911e1070"
},
"VolumesRW": {
"/data": true
}
}
] |
Is someone has a solution to stop those kind of ghost containers without restarting the daemon? (I even don't know if restarting the daemon will stop those ghost containers) |
@enguerran The workaround for me was to stop docker, kill the ghost containers manually, remove |
is everyone here using aufs trying to reproduce |
@jfrazelle I've got this error exactly on aufs! But my containers starts and stops automatically - i can't get any steps to reproduce :( |
So the next time anyone encounters this can you check:
all of this information would be very very helpful |
@jfrazelle in my case the process with pid from container's inspect does not exist.
wherein no process with pid from container's inspect and
|
@PlugIN73 It is superimportant information. |
@LK4D4 i saw them less than a week ago. Now i can't find this processes because i killed them. I didn't understand how it possible (and I could not compare these processes with these dead containers - not enough information). |
@PlugIN73 Yeah, we don't understand how it possible too :/ |
Also, all who encounter this issue: how do you run your processes inside? Is it like with supervisord or maybe sh script which starts something. I'm in particular interested if there is problems with simple one-processes inside container. |
@LK4D4 Here it happened to our collins image which uses the official collins image as FROM[1]. We run reefer[2] as entrypoint which then exec's java, so it's single process and no bash is involved. I'm also using btrfs, so it's not limited to aufs. |
It has happened twice to me using the image found here (it also uses supervisor): https://github.com/heyman/graphite_docker |
+1 |
I think the same happened to me on docker 1.10.1:
docker logs:
I send a No way of making it dissapear. |
If you've got a container that just won't die after you
Where It's not a fix, but it's an effective workaround. |
happend to me too on osx with latest docker machine. Only working walkaround was one provided by @dkinzer |
Just happened to me. In production! Docker-machine deployed on AWS, OS X as dev environment. I really start to doubt my decision to embrace Docker as a solution for structuring our service. |
(Repro: one of the containers was hanging with 100% cpu, attempted to shutdown, failed, tried to restart docker-container, got stuck.) Now having to restart docker-machine and regenerate certs, as IP has changed. This takes time. |
I recently faced this issue on docker 1.10.x My error being: Resolution:
|
This is difficult to reproduce since it relies on some weird area where libcontainer's state differs from what we expect. We also no longer use libcontainer directly (in Docker 1.11) but instead execute containers via Issue is probably actually fixed in this commit: I think we can close this but will leave open for others to comment. |
Is there any workaround without restarting the docker daemon? this is quite annoying in the production. We are using docker 1.9.1. We also see some cgroup settings are left over |
We had the same problem here today. The comment of @mpalmer did help a lot but not completely. We found out that you can do the following:
|
Did not work for us. The
command did delete the entries form lscgroup, but the container ist still in Docker engine restart fixes the problem for us, but this is not an acceptable workaround. Just as an addition to the cases before. We triggered it a couple of times with using for the record:
|
I had the same issue, when I inspect the container the Pid that Docker knows about no longer exists:-
I am not sure how Docker go into this issue but shouldn't Docker check to see if the Pid exists before trying to stop the container? |
Containers: 5 docker version same issue |
Closing as this is no longer an issue for 1.11. |
When a container exists right around when Docker was attempting to restart it, it might get into an awkward state that makes it impossible to restart. Resolving the issue involves restarting the Docker daemon, which isn't particularly desirable for us. So, in order to be able to send SIGTERM to all processes in a cgroup, without making Docker crazy, we'll just wait for the cgroup to exit ourselves. If it doesn't, then we'll ask Docker to kill it with prejudice immediately (i.e. `docker kill -t 0`). This appears to be resolved in 1.11 (and to be most common on 1.9), but not all our infrastructure is there yet. See: moby/moby#12738
When a container exists right around when Docker was attempting to restart it, it might get into an awkward state that makes it impossible to restart. Resolving the issue involves restarting the Docker daemon, which isn't particularly desirable for us. So, in order to be able to send SIGTERM to all processes in a cgroup, without making Docker crazy, we'll just wait for the cgroup to exit ourselves. If it doesn't, then we'll ask Docker to kill it with prejudice immediately (i.e. `docker kill -t 0`). This appears to be resolved in 1.11 (and to be most common on 1.9), but not all our infrastructure is there yet. See: moby/moby#12738
Hi all, Facing an issue while stopping a running container that is using NFS client to communicate with storage mounted on a separate hosts through NFS. When I run docker stop <container_id>, it stays hang for quite sometime without showing any change in state process. Any fix for this ?? |
@suchakra012 please don't comment on closed issues with unrelated questions; if you suspect there's a bug, open a new issue; for questions about running docker, either https://forums.docker.com, the #docker IRC channel, or StackOverflow are probably better |
@thaJeztah Ok fine. |
I'm going to comment on a closed issue. Forgive me Father. It is most definitely my sin that I use docker 18.06.1-ce and I still experience this problem. Since there was not a single solution posted to people who experience this problem in the wild (a lot of try this and that), here is a rock solid approach.
I apologize for the snark. It is sin that causes me to do things that are bad, but this was particularly unfortunate to encounter in production with the normal things not working, and no way to really detect this without attaching a logger to syslog to catch the crashed docker instance. |
docker rm -f 3ed2 what the problem here? |
Docker fails to stop a container:
Docker version and info:
The text was updated successfully, but these errors were encountered: