moby: docker start returns "container already exists"
Description
docker start
returns Error response from daemon: container <hash>: already exists
This happened after I installed the latest upgrade.
The only other change I did was to remove check from “Enable kubernetes” and apply that change (from docker preferences window).
Describe the results you received:
dps -a
IMAGE NAMES PORTS COMMAND STATUS
jetty infallible_hodgkin "/docker-entrypoint.…" Exited (0) 2 weeks ago
jetty gallant_perlman "/docker-entrypoint.…" Exited (1) 2 weeks ago
docker.elastic.co/elasticsearch/elasticsearch:5.6.3 st-es 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp "/bin/bash bin/es-do…" Exited (255) 18 minutes ago
appbaseio/mirage mystifying_meitner 0.0.0.0:3030->3030/tcp "http-server '-p 303…" Exited (255) 2 months ago
appbaseio/dejavu heuristic_jones 0.0.0.0:1358->1358/tcp "http-server '-p 135…" Exited (255) 2 months ago
mongo mongo 0.0.0.0:27017->27017/tcp "docker-entrypoint.s…" Exited (255) 5 weeks ago
zookeeper st-zk 2888/tcp, 0.0.0.0:2181->2181/tcp, 3888/tcp "/docker-entrypoint.…" Exited (255) 18 minutes ago
mysql:5.5 st-mysql 0.0.0.0:3306->3306/tcp "docker-entrypoint.s…" Exited (255) 18 minutes ago
%
%
% docker start st-mysql
Error response from daemon: container "fa0db3388ad6eb043d8632039c152f58afb68dbb6a2c5a3a7721420a56518477": already exists
Error: failed to start containers: st-mysql
Output of docker version
:
Client:
Version: 18.02.0-ce-rc1
API version: 1.35
Go version: go1.9.2
Git commit: 5e1d90a
Built: Thu Jan 25 00:33:50 2018
OS/Arch: darwin/amd64
Experimental: true
Orchestrator: swarm
Server:
Engine:
Version: 18.02.0-ce-rc1
API version: 1.36 (minimum version 1.12)
Go version: go1.9.3
Git commit: 5e1d90a
Built: Thu Jan 25 00:40:43 2018
OS/Arch: linux/amd64
Experimental: false
Output of docker info
:
Containers: 8
Running: 1
Paused: 0
Stopped: 7
Images: 32
Server Version: 18.02.0-ce-rc1
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 157
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9b55aab90508bd389d7654c4baf173a981477d55
runc version: 9f9c96235cc97674e935002fc3d78361b696a69e
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.75-linuxkit-aufs
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 3
Total Memory: 1.952GiB
Name: linuxkit-025000000001
ID: TLZO:G2VR:E4RK:4L5T:7QZ3:56R3:WSBW:Z7XW:LQMW:AXRE:5QZU:Z3HA
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 28
Goroutines: 45
System Time: 2018-01-30T14:51:16.971310166Z
EventsListeners: 2
HTTP Proxy: docker.for.mac.http.internal:3128
HTTPS Proxy: docker.for.mac.http.internal:3128
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 16
- Comments: 67 (19 by maintainers)
@arnekick
my solution for all containers:
docker-containerd-ctr --address /run/docker/containerd/docker-containerd.sock --namespace moby c rm $(docker ps -aq --no-trunc)
@arnekick If you are on mac/windows you’ll need to run that command in a container.
Should be able to do something like:
This may help shed light… I came across this issue today.
Installed Docker on a Windows 10 machine that has never had docker before.
Version 18.02.0-ce-rc1 (Edge channel)
Running this command:
docker run -d --hostname my-rabbit --name super-rabbit -p 8090:15672 -p 8091:5672 rabbitmq:3-management
If I stop the docker service, or restart my computer, or stop the container manually, it is impossible to get it started again.
docker start super-rabbit
always give this error:Error response from daemon: container "<containerId>: already exists" Error failed to start containers:
Fixed in #36249
i’m not sure whether this is the same issue, but i’m experiencing this after an upgrade from
18.01.0-1
to18.02.0-1
on Arch Linux and a following reboot for the first time.edit: downgrading allowed me to use the exsiting containers. phew.
@djl394922860 Hi, try to reinstall older build of Docker for Mac. For me, only 21669 fixes.
https://download.docker.com/mac/edge/22256/Docker.dmg https://download.docker.com/mac/edge/22026/Docker.dmg https://download.docker.com/mac/edge/21669/Docker.dmg
same issue with docker4mac
I noticed the same problem after upgrade docker from
19.03.1
to19.03.13
.I kill a process named
containerd-shim -namespace moby ..........
which find by:Then I delete a directory.
It works now. Thanks everyone.
My env
I solved the issue on Windows by changing the workaround posted by @cpuguy83 in this way:
I’m not an expert, so use at your own risk. Thanks everyone!
ORIGINAL: @cpuguy83 On Windows, I get the following error when trying your workaround:
Entering in the container with bash reveals that the host folder is indeed missing from container. I should probably mount a different folder on Windows, but I can’t find the docker-container-ctr command anywhere.
Any help would be appreciated Thanks
I was facing the same issue when I shut down my computer without stopping the running container correctly. I ran
docker rm <container>
beforedocker run [OPTIONS] <image>
and then I was able to start and stop the container again. This whole ‘problem’ wasn’t a thing in the previous version (v18.01.0-ce) though.FYI for those looking to rollback: If you know the build number of the release you want to roll back to…and don’t have the file in your ‘Downloads’…you can always just download a prior release – if you know the build number.
For me this was ‘18.01.0-cd-mac48 (22026)’ (the version I was running before the upgrade introduced this bug), so the URL to re-download was:
You can replace
edge
withstable
to get access to the Stable builds.Stop Docker if it is currently running, and just install over it…everything is working again for me. I’ll run this version until I see that this bug has been fixed. I wrote a quick bash script, based on another Github issue about accessing older build, to surf the download server for available builds and print them out.
PM me if you are interested in a copyI put the script up on Github: https://github.com/john3exonets/surfDockerBuilds.Rollback to build 22026, 22256 not work. Finally, first edge build with Kubernetes
21669
saves me.https://download.docker.com/mac/edge/21669/Docker.dmg
Ok, I’m investigating a number of cases where this can happen.
The main issue comes down to the fact that in the pre-1.0 containerd API, a container
Create
API request would actually run the container. With containerd 1.0, there are two layers of abstractionTo simplify integration with containerd 1.0, docker is not currently using the container object/metadata stuff and basically just deletes the container from containerd when the container is stopped/exits/whatever.
So it seems in some case (or cases) moby is not able to cleanup the container object from containerd. Most likely this is incorrect error handling in moby.
@303linuxgroup not related; that error tells that you’re trying to create two containers with the same name. That doesn’t look like a bug, but a user-error (container names must be unique). Remove the old container before creating a new container with the same name.
When I update the image tag(docker load -i xxxxx), docker is not stopped,Now my device also has this problem,I thought the new version fixes this problem Cannot create container for service xxxxxx: Conflict. The container name “xxxxxx” is already in use by container “34fb9e3986e7f79803dd1aca1e77b0b635dff719d2e39a8e38e53eab5739f513”. You have to remove (or rename) that container to be able to reuse that name.
My env:
Server: Docker Engine - Community Engine: Version: 20.10.8 API version: 1.41 (minimum version 1.12) Go version: go1.16.6 Git commit: 75249d8 Built: Fri Jul 30 19:52:00 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.4.9 GitCommit: e25210fe30a0a703442421b0f60afac609f950a3 runc: Version: 1.0.1 GitCommit: v1.0.1-0-g4144b63 docker-init: Version: 0.19.0 GitCommit: de40ad0
@Eyshika You can upgrade or you can do:
Where that long ID is the ID reported as already existing when you try to start the container.
18.06 is older and does not have the fix.
@nachopro There are several work-arounds posted in this issue.
Hi, today after computer crashed my containers was never wake up again 😦
I’m using Docker version 18.02.0-ce, build fc4de447b5 @ ArchLinux 1 mos ago without any problem.
Any suggestion is welcome;
One way I have found to reproduce this is:
docker run -d --name test busybox top
kill -9 <dockerd pid>
docker start test
This would conceivably be repro’d on a reboot where dockerd was not able to properly shutdown the container on exit. The key here is that the process exits while dockerd is not processing events (i.e. when it’s down) and the shim is also killed.
The one weird thing here is that it is strange that in d4mac it seems common that docker has not processed a container exit… assuming this is happening on shutdown but again I don’t know why the container shutdown is not caught.
Unfortunately an automated test for this is not all that simple since it does require killing the containerd-shim. I will work up a fix for this case and get it backported to 17.12.
I’m not sure that I could get something in time for the Docker 18.02 release…
Latest edge channel version (Version 18.02.0-ce-rc2-mac51 (22446)) has the same issue.