Skip to content

feat: support podman volatile containers #3684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion container/podman/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import (
)

const (
containersJSONFilename = "containers.json"
containersJSONFilename = "containers.json"
volatileContainersJSONFilename = "volatile-containers.json"
)

type containersJSON struct {
Expand All @@ -44,6 +45,25 @@ func rwLayerID(storageDriver docker.StorageDriver, storageDir string, containerI
return "", err
}

// Read volatile-containers.json if it exists.
// This is important for Podman Quadlets since they are not presented in the containers.json file.
volatileData, err := os.ReadFile(filepath.Join(
storageDir,
string(storageDriver)+"-containers",
volatileContainersJSONFilename,
))
if err != nil && !os.IsNotExist(err) {
return "", err
}
if volatileData != nil {
var volatileContainers []containersJSON
err = json.Unmarshal(volatileData, &volatileContainers)
if err != nil {
return "", err
}
containers = append(containers, volatileContainers...)
}

for _, c := range containers {
if c.ID == containerID {
return c.Layer, nil
Expand Down