Skip to content
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 start container: [0] Id already in use #20570

Closed
Salmondx opened this issue Feb 22, 2016 · 23 comments
Closed

Cannot start container: [0] Id already in use #20570

Salmondx opened this issue Feb 22, 2016 · 23 comments
Labels
kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. version/1.9

Comments

@Salmondx
Copy link

Can't start existing docker container with mongodb.
docker ps -a shows that this container exists:

6d33bbf4bce9 mongo:latest "/entrypoint.sh mongo" 47 minutes ago Exited (-1) 22 minutes ago hotels-mongo

And when i start it with docker start hotels-mongo, this exception throws:
Error response from daemon: Cannot start container hotels-mongo: [0] Id already in use: Container with id exists: 6d33bbf4bce902279721419a062bcd7d2ddcffdd8ef13d70bcd5e7ae71cf5c10
Error: failed to start containers: [hotels-mongo]

Also can't start through kitematic.
This container worked for 2-4 weeks and now it doesn't.

Docker version:
Client:
Version: 1.8.3
API version: 1.20

Server:
Version: 1.9.1
API version: 1.21

@HackToday
Copy link
Contributor

please append all you docker ps -a output here

@thaJeztah
Copy link
Member

Hm, looks like this #11432, which (IIUC) can be the result of the container-state being out of sync with the actual state

@aldarund
Copy link

aldarund commented Mar 6, 2016

I have same issue.

$ docker-compose.exe up
esanumdjango_db_1 is up-to-date
Starting esanumdjango_elasticsearch_1
�[31mERROR�[0m: Cannot start container 2a8759fc91956558a2fef5ddcdd6b03404e574d8cf3b9a28331b96bfb8430b4d: [0] Id already in use: container with id exists: 2a8759fc91956558a2fef5ddcdd6b03404e574d8cf3b9a28331b96bfb8430b4d
$ docker --version
Docker version 1.10.2, build c3959b1
ShapeR@shfs MINGW64 ~/PycharmProjects/esanum-django (docker)
$ docker ps -a
CONTAINER ID        IMAGE                                                    COMMAND                  CREATED             STATUS                       PORTS                    NAMES
64a9a6496e63        a4adf1fd15e0                                             "/entrypoint.sh"         2 days ago          Exited (137) 4 minutes ago   0.0.0.0:8001->8000/tcp   esanum_dj
db71e319cad0        esanumdjango_db                                          "/docker-entrypoint.s"   2 days ago          Up 2 minutes                 5432/tcp                 esanumdjango_db_1
3d9b63b4adcb        133662108267.dkr.ecr.us-east-1.amazonaws.com/djrentapp   "/entrypoint.sh"         3 days ago          Exited (137) 4 minutes ago   0.0.0.0:8000->8000/tcp   rentapp
153ddac38313        133662108267.dkr.ecr.us-east-1.amazonaws.com/djrentapp   "celery -B -A rentapp"   3 days ago          Exited (137) 4 minutes ago   8000/tcp                 rentworker
d4a5fdabcf46        djangorentapplication_db                                 "/docker-entrypoint.s"   3 days ago          Exited (137) 4 minutes ago   5432/tcp                 djangorentapplication_db_1
2a8759fc9195        elasticsearch:1.7                                        "/docker-entrypoint.s"   3 days ago          Exited (-1) 4 minutes ago                             esanumdjango_elasticsearch_1
4963a850f554        redis                                                    "/entrypoint.sh redis"   4 days ago          Exited (137) 4 minutes ago   6379/tcp                 djangorentapplication_broker_1
3ba60b88de6e        f1361cef5379                                             "/bin/sh -c 'uwsgi --"   4 days ago          Exited (1) 4 days ago                                 sharp_swirles

@thaJeztah thaJeztah added the kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. label Mar 7, 2016
@boaz0
Copy link
Member

boaz0 commented Mar 21, 2016

I believe docker inspect mongo-hotels may shed light on that problem.

@monkeyboy64
Copy link

I'm seeing this same issue:

ubuntu@ip-10-0-1-10:/var/www/numetric/deploy$ docker --version
Docker version 1.10.2, build c3959b1

ubuntu@ip-10-0-1-10:/var/www/numetric/deploy$ sudo docker start 95983f0887dc
Error response from daemon: Cannot start container 95983f0887dca00f742dd9370a345d3f7b52d1152e66d441c5ec2b3453de0b76: [0] Id already in use: container with id exists: 95983f0887dca00f742dd9370a345d3f7b52d1152e66d441c5ec2b3453de0b76
Error: failed to start containers: 95983f0887dc

ubuntu@ip-10-0-1-10:/var/www/numetric/deploy$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e3a995f1d07e numetric/haproxy:dev "/docker-entrypoint.s" 14 minutes ago Restarting (0) 24 seconds ago 0.0.0.0:3200->3200/tcp deploy_haproxy_proxy_1
a8627f411267 numetric/api:dev "npm start" 2 hours ago Created deploy_numetric_api_10
f60b5ff9d570 numetric/api:dev "npm start" 2 hours ago Created deploy_numetric_api_9
06b2c0d08068 numetric/api:dev "npm start" 2 hours ago Created deploy_numetric_api_8
c4cf01e79e4d numetric/api:dev "npm start" 2 hours ago Exited (-1) 2 hours ago deploy_numetric_api_7
a75eecaf3dcb numetric/api:dev "npm start" 2 hours ago Exited (-1) 2 hours ago deploy_numetric_api_6
62c85cc35e64 numetric/api:dev "npm start" 2 hours ago Exited (-1) 2 hours ago deploy_numetric_api_4
59527bc0f2d7 numetric/api:dev "npm start" 2 hours ago Restarting (254) 31 minutes ago deploy_numetric_api_2
a64569792aae numetric/scriptrunner:dev "python main.py" 2 hours ago Exited (-1) 2 hours ago deploy_scriptrunner_10
475308f4ca95 numetric/scriptrunner:dev "python main.py" 2 hours ago Exited (-1) 2 hours ago deploy_scriptrunner_8
2b80fca354fd numetric/scriptrunner:dev "python main.py" 2 hours ago Exited (-1) 2 hours ago deploy_scriptrunner_2
a667147d2522 numetric/scriptrunner:dev "python main.py" 2 hours ago Exited (-1) 2 hours ago deploy_scriptrunner_5
29aff7ba9e17 numetric/taskrunner:dev "python main.py" 2 hours ago Exited (-1) 2 hours ago deploy_taskrunner_7
41132cde527f numetric/taskrunner:dev "python main.py" 2 hours ago Exited (-1) 2 hours ago deploy_taskrunner_5
c68a193d2a96 numetric/taskrunner:dev "python main.py" 2 hours ago Exited (-1) 2 hours ago deploy_taskrunner_3
d0f0e7e7f09b numetric/taskrunner:dev "python main.py" 2 hours ago Restarting (1) 31 minutes ago deploy_taskrunner_2
98afb325dd21 numetric/scriptrunner:dev "python main.py" 2 hours ago Restarting (1) 31 minutes ago deploy_scriptrunner_1
25bde80ae9d2 numetric/api:dev "npm start" 2 hours ago Exited (-1) 2 hours ago deploy_numetric_api_1
340a642b417d numetric/taskscheduler:dev "python main.py" 2 hours ago Restarting (1) 31 minutes ago deploy_taskscheduler_1
d8f882539140 numetric/taskrunner:dev "python main.py" 2 hours ago Exited (-1) 2 hours ago deploy_taskrunner_1
95983f0887dc numetric/rethinkdb:dev "rethinkdb proxy --bi" 13 days ago Exited (-1) 2 hours ago deploy_rethinkdb_proxy_1

@RominYue
Copy link

I got same issue
When I restart docker service, I would start the following container, but error occurs.

$docker ps -a
CONTAINER ID  IMAGE               COMMAND      CREATED       STATUS
591009977bae  yomin/deepdive:1.0  "/bin/bash"  3 weeks ago   Exited (-1) 3 hours ago

Error:

$docker start -i -a 591009977bae
Error response from daemon: Cannot start container 591009977bae: [0] Id already in use: Container with id exists: 591009977baefe0ad7986b3149e9c8090655c3419b46e72bfa0c554189a54739

The following is some info, server is Ubuntu14.04:

$docker info
Containers: 6
Images: 60
Server Version: 1.9.1
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 76
Dirperm1 Supported: false
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.13.0-24-generic
Operating System: Ubuntu 14.04.3 LTS
CPUs: 24
Total Memory: 94.37 GiB
Name: ubuntu
ID: P322:L4XK:BGEL:AAZ4:O6VF:IX2O:AUMK:QCBD:RJIS:RGOU:LCJI:GDGU
WARNING: No swap limit support

@thaJeztah
Copy link
Member

This will probably be resolved with the containerd integration in Docker 1.11. I'll leave this open for now, because it's not an error that occurs frequently, and is hard to reproduce, but if anyone still sees it with 1.11 (once released) please reply, otherwise I'll close this after some time (after 1.11)

@Arno0x
Copy link

Arno0x commented Apr 1, 2016

I get the exact same issue. Is there a way to work around this ? Like doing some manual cleaning or remove some lock files ? Because until this bug is resolved, how do I restart my container ?

docker start -a -i kali
Error response from daemon: Cannot start container 1fefdf0e627a2e68fbfe00208963fb6f059aeb20ddc54e06f21fe89e98a3be31: [0] Id already in use: container with id exists: 1fefdf0e627a2e68fbfe00208963fb6f059aeb20ddc
54e06f21fe89e98a3be31

@Arno0x
Copy link

Arno0x commented Apr 1, 2016

Just found a manual workaround, all it needs is to delete the following directory:
/run/docker/execdriver/native/dockerID.
For instance, in my case:

sudo rm /run/docker/execdriver/native/1fefdf0e627a2e68fbfe00208963fb6f059aeb20ddc54e06f21fe89e98a3be31

@rszczypka
Copy link

For me, restarting the machine solved the problem

@cpuguy83
Copy link
Member

Closing this since this is not a valid error since at least 1.11... I think it may even be cleared up by 1.10... but definitely at least 1.11.

Docker does not itself execute containers anymore since 1.11 and relies on runc from OCI. There is no execdriver anymore. The error itself was fixed in libcontainer (which OCI uses) awhile back and the error itself doesn't exist anymore.

If you run into more issues, please open a new one. Thanks!

@dannydulai
Copy link

without upgrading, is there a way to recover the container?

@TroelsL
Copy link

TroelsL commented Feb 16, 2017

I just had this issue on 1.13.1 immediately after upgrading, I can't start some (not all) of my containers.

A reboot of Ubuntu fixed it.

@cpuguy83
Copy link
Member

@TroelsL Please open a new issue with as much detail as you can provide.

@cc20101001
Copy link

Error response from daemon: id already in use
Error: failed to start containers: 5b44d212e7aa

i had the same problem,

1.update the docker for mac from Docker version 18.02.0-ce to Docker version 18.03.0-ce
2.you can try start the container by container_name

for example:

docker start [container_name]

good luck to you

@crazyfree
Copy link

i got that problem also, and my solution is very simple docker-compose down -v then docker-compose up -d again.

@cljk
Copy link

cljk commented Dec 28, 2018

Have the same issue

Server: Docker Engine - Community
 Engine:
  Version:          18.09.0
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       4d60db4
  Built:            Wed Nov  7 00:16:44 2018
  OS/Arch:          linux/amd64
  Experimental:     false

I had daily reboots enabled on one of my webservers (Ubuntu 18.04.1). On SOME boots, the containers are not startet.
I called service docker restart several times - and after third call the starting was successful.

Previous log entries:

Dez 28 03:16:19 www dockerd[939]: time="2018-12-28T03:16:19.530886826Z" level=error msg="Failed to start container a8f0c68e1aa88c02c6a974c52d3f3063e3bb42198d95da1ece3045a353729ae1: id already in use"
Dez 28 03:16:19 www dockerd[939]: time="2018-12-28T03:16:19.872740411Z" level=error msg="Failed to start container 3d9141cd31048c5d56cca05e89c706ab497a42f135e8a634d13c9f28bb526c7e: id already in use"
Dez 28 03:16:20 www dockerd[939]: time="2018-12-28T03:16:20.871394183Z" level=error msg="Failed to start container 492bc3d57ddf9b03d1a6f93900f8fe256252b6e760c875221fbe4f5076e7e329: id already in use"
Dez 28 03:16:21 www dockerd[939]: time="2018-12-28T03:16:21.547818052Z" level=error msg="Failed to start container 274aea0d83a8db66a048dfe07135285953bcf8295e8e165e775b3c3ba039843e: id already in use"
Dez 28 03:16:21 www dockerd[939]: time="2018-12-28T03:16:21.582269285Z" level=error msg="Failed to start container eee6c4e907d0ab1c2d4d055abaad09e4072200fb1720e6c12626857fdc24bc9a: id already in use"
Dez 28 03:16:21 www dockerd[939]: time="2018-12-28T03:16:21.582393418Z" level=info msg="Loading containers: done."
Dez 28 03:16:22 www dockerd[939]: time="2018-12-28T03:16:22.137824204Z" level=info msg="Docker daemon" commit=4d60db4 graphdriver(s)=overlay2 version=18.09.0
Dez 28 03:16:22 www dockerd[939]: time="2018-12-28T03:16:22.149087112Z" level=info msg="Daemon has completed initialization"
Dez 28 03:16:22 www dockerd[939]: time="2018-12-28T03:16:22.305528298Z" level=info msg="API listen on /var/run/docker.sock"
Dez 28 03:16:22 www systemd[1]: Started Docker Application Container Engine.

At time of the log entries NO containers were up...

@evandrojr
Copy link

i got that problem also, and my solution is very simple docker-compose down -v then docker-compose up -d again.

Thanks! That worked for me!

@biju-ps
Copy link

biju-ps commented Feb 23, 2019

Same issue here

Feb 23 09:01:53 falcon dockerd[1549]: time="2019-02-23T09:01:53.105003904+05:30" level=error msg="Failed to start container 54a981d61e3ba156173a2e544d67bb8c107d382ab5726cefee6157bb71a7d2ee: id already in use"
Feb 23 09:01:53 falcon dockerd[1549]: time="2019-02-23T09:01:53.343868152+05:30" level=error msg="Failed to start container 9838d842ce3e4b29cc43edc9697f1a7bb5d7222805c509d83d770aaebe2b0568: id already in use"
Feb 23 09:01:53 falcon dockerd[1549]: time="2019-02-23T09:01:53.429832085+05:30" level=error msg="Failed to start container c761982d00f7035e08aff4ec2a9d528795a57fcf2124b4588aaa50a31978c006: id already in use"
Feb 23 09:01:53 falcon dockerd[1549]: time="2019-02-23T09:01:53.459198733+05:30" level=error msg="Failed to start container 154dbbbc66507876ad661bdaa2b2471d6534261ffaae49be201435b069e14a6d: id already in use"

but start working after the server restart .. but this is the second time we are experiencing this

here is the info

Containers: 4
 Running: 4
 Paused: 0
 Stopped: 0
Images: 7
Server Version: 18.09.1
Storage Driver: btrfs
 Build Version: Btrfs v4.7.3
 Library Version: 101
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9754871865f7fe2f4e74d43e2fc7ccd237edcbce
runc version: 96ec2177ae841256168fcf76954f7177af9446eb
init version: fec3683
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.15.0-45-generic
Operating System: Ubuntu 18.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.51GiB
Name: falcon
ID: C6TP:5PH6:RWP3:F3WI:COXF:6DPS:5MME:ZTBG:ICV2:GIOK:OATH:22C6
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

WARNING: No swap limit support

@Linzdigr
Copy link

Restarting docker service and then restarting containers solved the id already in use problem without the need of removing them for me.

@zxlin
Copy link

zxlin commented Nov 16, 2019

We're experiencing this issue where we need to rm the /run/docker/runtime-runc/moby/<containerid> directory when the container is stopped in order to start it up again due to the error message: OCI runtime create failed: container with id exists: <containerid>: unknown

We do not have a reliable way to repro this behavior, but it does happen very often in our rather large environment (more than 30 impacted containers out of 900+).

Restarting dockerd or the server itself is not an option for us, any suggestions? I'd be happy to help create a patch if there's any ideas where to start looking.

Server:
 Containers: 977
  Running: 403
  Paused: 0
  Stopped: 574
 Images: 31
 Server Version: 19.03.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339
 runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
 init version: fec3683
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 4.15.0-1054-aws
 Operating System: Ubuntu 18.04.3 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 72
 Total Memory: 137.5GiB
 Name: docker
 ID: IGSA:ZFGF:6WUS:GYDG:J5OV:AWYO:UNRD:HDFN:R6UR:SINP:X5A3:BEXB
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No swap limit support

@nrafal
Copy link

nrafal commented Dec 10, 2019

In my case it was connected to permissions I'm sure - I suspect that maybe container were started with root, so I couldn't restart them as a normal user. After stopping them from root I could normally start it from regular user.

@mailbyms
Copy link

mailbyms commented Feb 5, 2021

I just had this issue on 1.13.1 immediately after upgrading, I can't start some (not all) of my containers.

A reboot of Ubuntu fixed it.

It works! Save my day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. version/1.9
Projects
None yet
Development

No branches or pull requests