(containerID, storageDir string, sd StorageDriver, dockerVersion []int)
| 107 | var _ container.ContainerHandler = &containerHandler{} |
| 108 | |
| 109 | func getRwLayerID(containerID, storageDir string, sd StorageDriver, dockerVersion []int) (string, error) { |
| 110 | const ( |
| 111 | // Docker version >=1.10.0 have a randomized ID for the root fs of a container. |
| 112 | randomizedRWLayerMinorVersion = 10 |
| 113 | rwLayerIDFile = "mount-id" |
| 114 | ) |
| 115 | if (dockerVersion[0] <= 1) && (dockerVersion[1] < randomizedRWLayerMinorVersion) { |
| 116 | return containerID, nil |
| 117 | } |
| 118 | |
| 119 | bytes, err := os.ReadFile(path.Join(storageDir, "image", string(sd), "layerdb", "mounts", containerID, rwLayerIDFile)) |
| 120 | if err != nil { |
| 121 | return "", fmt.Errorf("failed to identify the read-write layer ID for container %q. - %v", containerID, err) |
| 122 | } |
| 123 | return string(bytes), err |
| 124 | } |
| 125 | |
| 126 | // newContainerHandler returns a new container.ContainerHandler |
| 127 | func newContainerHandler( |
searching dependent graphs…