@@ -197,9 +197,18 @@ func newContainerHandler(
197197 rootfsStorageDir : rootfsStorageDir ,
198198 envs : make (map [string ]string ),
199199 labels : ctnr .Config .Labels ,
200+ image : ctnr .Config .Image ,
200201 metrics : includedMetrics ,
201202 thinPoolName : thinPoolName ,
202203 zfsParent : zfsParent ,
204+ reference : info.ContainerReference {
205+ // Add the name and bare ID as aliases of the container.
206+ Id : id ,
207+ Name : name ,
208+ Aliases : []string {strings .TrimPrefix (ctnr .Name , "/" ), id },
209+ Namespace : DockerNamespace ,
210+ },
211+ libcontainerHandler : containerlibcontainer .NewHandler (cgroupManager , rootFs , ctnr .State .Pid , metrics ),
203212 }
204213 // Health status may be nil if no health check is configured
205214 if ctnr .State .Health != nil {
@@ -210,16 +219,6 @@ func newContainerHandler(
210219 if err != nil {
211220 return nil , fmt .Errorf ("failed to parse the create timestamp %q for container %q: %v" , ctnr .Created , id , err )
212221 }
213- handler .libcontainerHandler = containerlibcontainer .NewHandler (cgroupManager , rootFs , ctnr .State .Pid , metrics )
214-
215- // Add the name and bare ID as aliases of the container.
216- handler .reference = info.ContainerReference {
217- Id : id ,
218- Name : name ,
219- Aliases : []string {strings .TrimPrefix (ctnr .Name , "/" ), id },
220- Namespace : DockerNamespace ,
221- }
222- handler .image = ctnr .Config .Image
223222
224223 if ctnr .RestartCount > 0 {
225224 handler .labels ["restartcount" ] = strconv .Itoa (ctnr .RestartCount )
0 commit comments