Solving Error response from daemon OCI runtime create failed container with id exists

I restarted system for the testing my new systemd service. After the restart my some dockers start via command and I get this error.

[email protected] ~>docker start bindnat64
Error response from daemon: OCI runtime create failed: container with id exists: 4871484679fsd498sg4hr9t989                                                                      9041a6b77dd7dc64b97e15cbd: unknown
Error: failed to start containers: bindnat64

For the detailed problem solving run docker in debug mode in command line.

[email protected] ~> service docker stop
[email protected] ~> dockerd --debug
INFO[2020-01-17T23:15:00.799572801Z] Starting up
DEBU[2020-01-17T23:15:00.816102056Z] Listener created for HTTP on unix (/var/run/docker.sock)
DEBU[2020-01-17T23:15:00.820722321Z] Golang's threads limit set to 2970
INFO[2020-01-17T23:15:00.836791146Z] parsed scheme: "unix"                         module=grpc
INFO[2020-01-17T23:15:00.837428925Z] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2020-01-17T23:15:00.838003954Z] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0  <nil>}] <nil>}  module=grpc
INFO[2020-01-17T23:15:00.838451356Z] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2020-01-17T23:15:00.859419482Z] parsed scheme: "unix"                         module=grpc
INFO[2020-01-17T23:15:00.860449827Z] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2020-01-17T23:15:00.861054713Z] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0  <nil>}] <nil>}  module=grpc
INFO[2020-01-17T23:15:00.861528201Z] ClientConn switching balancer to "pick_first"  module=grpc
DEBU[2020-01-17T23:15:00.871091213Z] Using default logging driver json-file
DEBU[2020-01-17T23:15:00.874882162Z] [graphdriver] priority list: [btrfs zfs overlay2 aufs overlay devicemapper vfs]
DEBU[2020-01-17T23:15:00.908944376Z] processing event stream                       module=libcontainerd namespace=plugins.moby
DEBU[2020-01-17T23:15:01.000878576Z] backingFs=extfs, projectQuotaSupported=false, indexOff="index=off,"  storage-driver=overlay2
INFO[2020-01-17T23:15:01.001615063Z] [graphdriver] using prior storage driver: overlay2
DEBU[2020-01-17T23:15:01.002094888Z] Initialized graph driver overlay2
***
ERRO[2020-01-17T23:15:02.591864507Z] stream copy error: reading from a closed fifo
ERRO[2020-01-17T23:15:02.592325661Z] stream copy error: reading from a closed fifo
***
INFO[2020-01-17T23:15:05.190269583Z] Loading containers: done.
INFO[2020-01-17T23:15:05.259382156Z] Docker daemon                                 commit=633a0ea838 graphdriver(s)=overlay2 version=19.03.5

😒

To solve this problem with remove container state folder inside docker folder.

#For example my container name bindnat64 and docker id is 4871484679fsd498sg4hr9t989.
[email protected] ~> rm -rf /var/run/docker/runtime-runc/moby/4871484679fsd498sg4hr9t989
[email protected] ~>docker start bindnat64
bindnat64

Looks like a problem solved but it`s not solved. When you try to execute program inside docker container you get another Error.

Close dockerd and restart your Server.

Hopely after the restarting system your docker container will be work without error.


Edit

In my case, I see this error again on my system. This time, it is a bit harder to fix then before. Because now it is not based on one container. My chance is all my containers is not important. So I deleted all stat information on a system.

[email protected] ~> rm -rf /var/run/docker/runtime-runc/moby/*
[email protected] ~> service docker stop
[email protected] ~> reboot

I restart my server and delete stat information, I do this process until docker service works without any problem.

I want to point that my distro is alpine. I don’t get any problem at ubuntu or my own embedded distro (whitedoor). Maybe this is caused only on alpine, but i dont have enough test to %100 sure.