Optimize `docker ps` when name/id filters in use
Optimize `docker ps` when name/id filters in use

When a partial ID or name is used in `docker ps` filters, today the
entire list of containers is walked even though there are shorter paths
to acquiring the subset of containers that match the ID or name. Also,
container's locks are used during this walk, causing increased lock
contention on a busy daemon.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>

nghiant2710/docker,stainboy/docker,tonistiigi/docker,sfsmithcha/docker,dims/docker,jzwlqx/denverdino.github.io,shishir-a412ed/docker,haveatry/docker,phiroict/docker,duglin/docker,xiekeyang/docker,dgageot/docker,cpuguy83/docker,jlhawn/docker,Ramzec/docker,trebonian/docker,docker/docker.github.io,catinthesky/docker,kerneltime/docker,afein/docker,noxiouz/docker,tophj-ibm/docker,mixja/docker,madhanrm/docker,mohmost12/docker,moby/moby,michelvocks/docker,shubheksha/docker.github.io,rillig/docker.github.io,vdemeester/docker,shin-/docker.github.io,alexisbellido/docker.github.io,pradipd/moby,jvanz/docker,estesp/docker,q384566678/docker,pradipd/moby,brahmaroutu/docker,troy0820/docker.github.io,bonczj/moby-json-file-logger,POLJM242/docker,akira-baruah/docker,laijs/docker,tmp6154/docker,docker/docker.github.io,mstanleyjones/docker,nghiant2710/docker,mixja/docker,troy0820/docker.github.io,denverdino/denverdino.github.io,thaJeztah/docker,aduermael/docker.github.io,coolljt0725/docker,HideoYamauchi/docker,dongjoon-hyun/docker,xiekeyang/docker,johnstep/moby-moby,jvanz/docker,londoncalling/docker.github.io,darrenstahlmsft/docker,nawawi/docker,dmcgowan/docker,erikh/docker,KarthikNayak/docker,q384566678/docker,zhuguihua/docker,twaugh/docker,rancher/docker,stevvooe/docker,raja-sami-10p/moby,JimGalasyn/docker.github.io,BSWANG/denverdino.github.io,yosifkit/docker,q384566678/docker,cr7pt0gr4ph7/docker,johnstep/moby-moby,anweiss/docker.github.io,denverdino/docker.github.io,shubheksha/docker.github.io,johnstep/docker.github.io,bonczj/moby-json-file-logger,AkihiroSuda/docker,tkopczynski/docker,flavio/docker,dperny/docker,ColinHebert/docker,alexisbellido/docker.github.io,tklauser/docker,prertik/docker,pecameron/docker,coolljt0725/docker,erikstmartin/docker,endophage/docker,kolyshkin/docker,mike1729/docker,mtrmac/docker,ajaymdesai/docker,endophage/docker,joaofnfernandes/docker.github.io,danix800/docker.github.io,splunk/docker,jwhonce/docker,aduermael/docker.github.io,wenchma/docker,maxamillion/docker,kencochrane/docker,yummypeng/docker,denverdino/denverdino.github.io,Ramzec/docker,gnailuy/docker,hypriot/docker,pramodhkp/moby,prertik/docker,cpuguy83/docker,lixiaobing10051267/docker,shishir-a412ed/docker,KarthikNayak/docker,projectatomic/docker,paralin/docker,yongtang/docker,JMesser81/docker,gjaskiewicz/moby,troy0820/docker.github.io,JMesser81/docker,jhorwit2/docker,docker-zh/docker.github.io,alfred-landrum/docker,yosifkit/docker,ibuildthecloud/docker,haveatry/docker,stevvooe/docker,tophj-ibm/moby,danix800/docker.github.io,splunk/docker,johnstep/docker.github.io,londoncalling/docker.github.io,resin-io/docker,hypriot/docker,mgoelzer/docker,portworx/docker,yasiramin10p/moby,lixiaobing1/docker,allencloud/docker,scotttlin/docker,alexisbellido/docker.github.io,splunk/docker,michael-holzheu/docker,HideoYamauchi/docker,docker-zh/docker.github.io,moul/docker,mike1729/docker,kunalkushwaha/docker,mixja/docker,maxamillion/docker,rhatdan/storage,Morsicus/docker,miminar/docker,toli/docker,eskaaren/docker,xuxinkun/docker,menglingwei/denverdino.github.io,xiaods/docker,anweiss/docker.github.io,YuPengZTE/docker,asbjornenge/docker,sterchelen/docker,diogomonica/docker,flavio/docker,jongiddy/docker,crosbymichael/docker,whuwxl/docker,noxiouz/docker,nalind/docker,AkihiroSuda/docker,ajaymdesai/docker,dsau/docker,charleszheng44/moby,sanscontext/docker.github.io,danyalKhaliq10p/moby,BSWANG/denverdino.github.io,ffoysal/docker,danyalKhaliq10p/moby,zhuguihua/docker,dims/docker,anweiss/docker.github.io,gnailuy/docker,mstanleyjones/docker,rhatdan/storage,jhorwit2/docker,noironetworks/docker,jimjag/docker,lixiaobing10051267/docker,thaJeztah/docker.github.io,PatrickLang/moby,shhsu/docker,jlhawn/docker,michelvocks/docker,allencloud/docker,pecameron/docker,ndeloof/docker,moul/docker,icaoweiwei/docker,Syntaxide/docker,dmcgowan/docker,ndeloof/docker,danix800/docker.github.io,jameszhan/docker,justyntemme/docker,menglingwei/denverdino.github.io,noironetworks/docker,yosifkit/docker,jhorwit2/docker,harche/docker,justincormack/docker,mikedougherty/docker,rillig/docker.github.io,jwhonce/docker,dsheets/moby,ajaymdesai/docker,naveed-jamil-tenpearls/moby,johnstep/docker.github.io,x1022as/docker,konstruktoid/docker-1,joeuo/docker.github.io,tagomoris/docker,kolyshkin/docker,Morsicus/docker,jimjag/docker,anweiss/docker.github.io,whuwxl/docker,Shopify/docker,Ramzec/docker,lixiaobing1/docker,maxamillion/docker,cyphar/docker,thaJeztah/docker,liaoqingwei/docker,harche/docker,joaofnfernandes/docker.github.io,dccurtis/docker,abhinavdahiya/docker,dsheets/moby,ibuildthecloud/docker,mstanleyjones/docker,coolljt0725/docker,kojiromike/docker,laijs/docker,medallia/docker,dmcgowan/docker,menglingwei/denverdino.github.io,mahak/docker,jzwlqx/denverdino.github.io,thtanaka/docker,coreos/docker,cyphar/docker,tophj-ibm/docker,charleszheng44/moby,johnstep/docker.github.io,JimGalasyn/docker.github.io,sdurrheimer/docker,JimGalasyn/docker.github.io,shubheksha/docker.github.io,darrenstahlmsft/docker,docker/docker,lixiaobing10051267/docker,PatrickLang/moby,x1022as/docker,charleswhchan/docker,pecameron/docker,trebonian/docker,AkihiroSuda/docker,joeuo/docker.github.io,sterchelen/docker,JimGalasyn/docker.github.io,thaJeztah/docker,mikebrow/docker,LuisBosquez/docker.github.io,coreos/docker,miminar/docker,LuisBosquez/docker.github.io,pramodhkp/moby,jameszhan/docker,noxiouz/docker,SvenDowideit/docker,bearstech/moby,djs55/docker,ffoysal/docker,noironetworks/docker,nalind/docker,kunalkushwaha/docker,rhatdan/docker,qudongfang/docker,thtanaka/docker,sarnautov/moby,djs55/docker,bdwill/docker.github.io,tmp6154/docker,thaJeztah/docker,konstruktoid/docker-upstream,tophj-ibm/moby,kencochrane/docker,rillig/docker.github.io,menglingwei/denverdino.github.io,bluebreezecf/docker,erikh/docker,akira-baruah/docker,konstruktoid/docker-upstream,sanjeo/docker,anweiss/docker.github.io,alfred-landrum/docker,joaofnfernandes/docker.github.io,estesp/docker,gnailuy/docker,mikedougherty/docker,djs55/docker,dperny/docker,diogomonica/docker,BSWANG/denverdino.github.io,brahmaroutu/docker,crosbymichael/docker,ColinHebert/docker,jlebon/docker,jimjag/docker,kolyshkin/moby,coreos/docker,denverdino/denverdino.github.io,gdevillele/docker.github.io,darrenstahlmsft/moby,gdevillele/docker.github.io,pradipd/moby,mahak/docker,amatsus/docker,Syntaxide/docker,nawawi/docker,portworx/docker,hqhq/moby,dsau/docker,Ramzec/docker,sanscontext/docker.github.io,paralin/docker,charleswhchan/docker,brahmaroutu/docker,ripcurld0/moby,nghiant2710/docker,toli/docker,endophage/docker,abhinavdahiya/docker,madhanrm/docker,paralin/docker,13W/docker,rhatdan/docker,wenchma/docker,xiekeyang/docker,mtrmac/docker,raja-sami-10p/moby,sdurrheimer/docker,jongiddy/docker,joaofnfernandes/docker.github.io,mikebrow/docker,thaJeztah/docker.github.io,yp-engineering/docker,rhatdan/storage,estesp/docker,xiaods/docker,danix800/docker.github.io,ripcurld0/moby,darrenstahlmsft/moby,hypriot/docker,flavio/docker,mtanlee/docker,srust/docker,xiaods/docker,konstruktoid/docker-upstream,medallia/docker,pramodhkp/moby,PatrickLang/moby,gschaetz/moby,thaJeztah/docker.github.io,HuKeping/docker,shin-/docker.github.io,thaJeztah/docker.github.io,konstruktoid/docker-1,denverdino/denverdino.github.io,afein/docker,bluebreezecf/docker,stainboy/docker,msabansal/docker,bonczj/moby-json-file-logger,shin-/docker.github.io,mikedougherty/docker,shubheksha/docker.github.io,srust/docker,kerneltime/docker,tophj-ibm/docker,nalind/docker,projectatomic/docker,bluebreezecf/docker,phiroict/docker,KingEmet/docker,michelvocks/docker,sanjeo/docker,yongtang/docker,dongjoon-hyun/docker,asbjornenge/docker,x1022as/docker,gschaetz/moby,rremer/moby,KingEmet/docker,gdevillele/docker.github.io,SvenDowideit/docker,mtanlee/docker,imkin/moby,justyntemme/docker,fcrisciani/docker,ndeloof/docker,Syntaxide/docker,mkumatag/docker,tonistiigi/docker,laijs/moby,mgoelzer/docker,sfsmithcha/docker,haveatry/docker,liaoqingwei/docker,rremer/moby,nalind/docker,BSWANG/denverdino.github.io,mkumatag/docker,kolyshkin/moby,gigidwan/docker,dnephin/docker,joaofnfernandes/docker.github.io,qudongfang/docker,thaJeztah/docker.github.io,ibuildthecloud/docker,denverdino/docker.github.io,yasiramin10p/moby,nawawi/docker,miminar/docker,jlebon/docker,moul/docker,alfred-landrum/docker,13W/docker,Mokolea/docker,justincormack/docker,aduermael/docker.github.io,joeuo/docker.github.io,docker-zh/docker.github.io,paralin/docker,medallia/docker,rancher/docker,madhanrm/docker,raja-sami-10p/moby,mahak/docker,medallia/docker,zhuguihua/docker,allencloud/docker,xuxinkun/docker,charleszheng44/moby,catinthesky/docker,cr7pt0gr4ph7/docker,jzwlqx/denverdino.github.io,mtesselH/docker,darrenstahlmsft/docker,sterchelen/docker,ColinHebert/docker,tagomoris/docker,mtesselH/docker,kolyshkin/moby,qudongfang/docker,cpuguy83/docker,jthelin/docker,gdevillele/docker.github.io,lixiaobing1/docker,cloudflare/docker,fcrisciani/docker,yongtang/docker,scotttlin/docker,rillig/docker.github.io,prertik/docker,HuKeping/docker,jzwlqx/denverdino.github.io,jongiddy/docker,portworx/docker,phiroict/docker,docker/docker.github.io,twaugh/docker,mohmost12/docker,kojiromike/docker,mohmost12/docker,vdemeester/docker,dgageot/docker,mikebrow/docker,docker/docker,Shopify/docker,tonistiigi/docker,ffoysal/docker,denverdino/docker.github.io,POLJM242/docker,Mokolea/docker,jzwlqx/denverdino.github.io,amatsus/docker,laijs/moby,laijs/docker,denverdino/docker.github.io,jlebon/docker,phiroict/docker,stevvooe/docker,shishir-a412ed/docker,mkumatag/docker,imkin/moby,johnstep/docker.github.io,twaugh/docker,containers/storage,tianon/docker,kunalkushwaha/docker,joeuo/docker.github.io,londoncalling/docker.github.io,dnephin/docker,LuisBosquez/docker.github.io,kencochrane/docker,rancher/docker,moypray/docker,mgoelzer/docker,cloudflare/docker,unclejack/docker,jwhonce/docker,aduermael/docker.github.io,docker-zh/docker.github.io,duglin/docker,shubheksha/docker.github.io,jlhawn/docker,bdwill/docker.github.io,YuPengZTE/docker,containers/storage,eskaaren/docker,imkin/moby,michael-holzheu/docker,cyphar/docker,erikstmartin/docker,Mokolea/docker,JimGalasyn/docker.github.io,shhsu/docker,jimjag/docker,docker-zh/docker.github.io,ibuildthecloud/docker,denverdino/docker.github.io,sanscontext/docker.github.io,gigidwan/docker,dsheets/moby,charleswhchan/docker,trebonian/docker,danyalKhaliq10p/moby,gjaskiewicz/moby,docker/docker,YuPengZTE/docker,jthelin/docker,dccurtis/docker,gjaskiewicz/moby,darrenstahlmsft/moby,jameszhan/docker,sanscontext/docker.github.io,denverdino/denverdino.github.io,diogomonica/docker,joeuo/docker.github.io,containers/storage,JMesser81/docker,alexisbellido/docker.github.io,yummypeng/docker,sarnautov/moby,sarnautov/moby,13W/docker,tklauser/docker,docker/docker.github.io,ibuildthecloud/docker,bdwill/docker.github.io,tklauser/docker,yosifkit/docker,nawawi/docker,toli/docker,tagomoris/docker,KarthikNayak/docker,tianon/docker,michael-holzheu/docker,bdwill/docker.github.io,Mokolea/docker,hqhq/moby,sanscontext/docker.github.io,dccurtis/docker,cpuguy83/docker,moypray/docker,AkihiroSuda/docker,mtesselH/docker,dsau/docker,LuisBosquez/docker.github.io,thtanaka/docker,konstruktoid/docker-upstream,justyntemme/docker,tkopczynski/docker,jvanz/docker,Morsicus/docker,moby/moby,kojiromike/docker,tkopczynski/docker,sdurrheimer/docker,flavio/docker,alexisbellido/docker.github.io,msabansal/docker,troy0820/docker.github.io,wenchma/docker,docker/docker.github.io,Shopify/docker,projectatomic/docker,dperny/docker,unclejack/docker,shhsu/docker,rhatdan/docker,sfsmithcha/docker,yp-engineering/docker,dongjoon-hyun/docker,dims/docker,fcrisciani/docker,hqhq/moby,trebonian/docker,justincormack/docker,liaoqingwei/docker,icaoweiwei/docker,13W/docker,bearstech/moby,rremer/moby,konstruktoid/docker-1,mtanlee/docker,bearstech/moby,HuKeping/docker,londoncalling/docker.github.io,mtrmac/docker,crosbymichael/docker,kerneltime/docker,erikh/docker,duglin/docker,moby/moby,msabansal/docker,shin-/docker.github.io,KingEmet/docker,afein/docker,laijs/moby,naveed-jamil-tenpearls/moby,menglingwei/denverdino.github.io,dnephin/docker,amatsus/docker,gschaetz/moby,abhinavdahiya/docker,scotttlin/docker,gigidwan/docker,yummypeng/docker,tmp6154/docker,gnailuy/docker,icaoweiwei/docker,johnstep/moby-moby,cr7pt0gr4ph7/docker,unclejack/docker,shin-/docker.github.io,londoncalling/docker.github.io,catinthesky/docker,sanjeo/docker,HideoYamauchi/docker,vdemeester/docker,whuwxl/docker,harche/docker,yasiramin10p/moby,erikstmartin/docker,srust/docker,moul/docker,SvenDowideit/docker,phiroict/docker,resin-io/docker,moby/moby,xuxinkun/docker,13W/docker,bdwill/docker.github.io,stainboy/docker,ripcurld0/moby,mahak/docker,naveed-jamil-tenpearls/moby,cloudflare/docker,gdevillele/docker.github.io,yp-engineering/docker,resin-io/docker,bearstech/moby,mike1729/docker,asbjornenge/docker,dgageot/docker,BSWANG/denverdino.github.io,LuisBosquez/docker.github.io,eskaaren/docker,moypray/docker,tophj-ibm/moby