Docker Multiple IDs found with provided prefix

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

Patrick

Administrator
Staff member
Dec 21, 2010
12,513
5,804
113
Has anyone ever seen "Error response from daemon: Multiple IDs found with provided prefix" before? I have run tens of thousands of Docker containers and never ran into that before.

Here is where it happened:
Code:
[root@testf ~]# docker run -itd -e threads=6 servethehome/monero_dwarfpool:nproc
de4c6f81b30f8b270440e54497667e226bd9f2f7455a62261b78d81874621d46
[root@testf ~]# docker attach de4
Error response from daemon: Multiple IDs found with provided prefix: de4c6f81b30f8b270440e54497667e226bd9f2f7455a62261b78d81874621d46
[root@testf ~]# docker ps
CONTAINER ID        IMAGE                                 COMMAND                  CREATED             STATUS              PORTS               NAMES
de4c6f81b30f        servethehome/monero_dwarfpool:nproc   "/usr/local/bin/mo..."   19 seconds ago      Up 18 seconds                           tender_perlman
 

sean

Member
Sep 26, 2013
67
33
18
CT
Were there any stopped containers with the same prefix? "de4" is only three characters so I estimate after 75 containers, you will likely (>50%) have a collision between at least two containers.
 

sean

Member
Sep 26, 2013
67
33
18
CT
I wrote a quick script to start containers, seen below. I ran it four times and saw collisions after 42, 55, and 26 tries. One time I didn't get any collisions after 101 tries so I upped the maximum count. There's a 30% chance of not seeing it after 100 containers but less than 1% to not see it after 200 container.

Code:
#!/bin/sh
 
for i in $(seq 200); do
    id=$(docker run -d docker.io/hello-world)
    short_id=${id:0:3}
    if ! docker inspect $short_id > /dev/null; then
        echo "$short_id collision; $i tries"
        break
    fi
done
Example output:
Code:
Error response from daemon: Multiple IDs found with provided prefix: 04c8331b22e144676b029305fe8a07790003d2abff00b45c9d428d8ee76f240a
04c collision; 26 tries