@@ -94,7 +94,7 @@ type containerHandler struct {
9494 libcontainerHandler * containerlibcontainer.Handler
9595
9696 // the docker client is needed to inspect the container and get the health status
97- client docker .APIClient
97+ client dclient .APIClient
9898}
9999
100100var _ container.ContainerHandler = & containerHandler {}
@@ -199,26 +199,26 @@ func newContainerHandler(
199199 rootfsStorageDir : rootfsStorageDir ,
200200 envs : make (map [string ]string ),
201201 labels : ctnr .Config .Labels ,
202+ image : ctnr .Config .Image ,
202203 metrics : includedMetrics ,
203204 thinPoolName : thinPoolName ,
204205 zfsParent : zfsParent ,
205206 client : client ,
207+ reference : info.ContainerReference {
208+ // Add the name and bare ID as aliases of the container.
209+ Id : id ,
210+ Name : name ,
211+ Aliases : []string {strings .TrimPrefix (ctnr .Name , "/" ), id },
212+ Namespace : DockerNamespace ,
213+ },
214+ libcontainerHandler : containerlibcontainer .NewHandler (cgroupManager , rootFs , ctnr .State .Pid , metrics ),
206215 }
216+
207217 // Timestamp returned by Docker is in time.RFC3339Nano format.
208218 handler .creationTime , err = time .Parse (time .RFC3339Nano , ctnr .Created )
209219 if err != nil {
210220 return nil , fmt .Errorf ("failed to parse the create timestamp %q for container %q: %v" , ctnr .Created , id , err )
211221 }
212- handler .libcontainerHandler = containerlibcontainer .NewHandler (cgroupManager , rootFs , ctnr .State .Pid , metrics )
213-
214- // Add the name and bare ID as aliases of the container.
215- handler .reference = info.ContainerReference {
216- Id : id ,
217- Name : name ,
218- Aliases : []string {strings .TrimPrefix (ctnr .Name , "/" ), id },
219- Namespace : DockerNamespace ,
220- }
221- handler .image = ctnr .Config .Image
222222
223223 if ctnr .RestartCount > 0 {
224224 handler .labels ["restartcount" ] = strconv .Itoa (ctnr .RestartCount )
0 commit comments