MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / GetComposeImages

Function GetComposeImages

agent/utils/compose/compose.go:119–135  ·  view source on GitHub ↗
(filePath string)

Source from the content-addressed store, hash-verified

117}
118
119func GetComposeImages(filePath string) ([]string, error) {
120 images, err := getComposeImagesByCommand(filePath)
121 if err == nil {
122 return images, nil
123 }
124
125 content, readErr := os.ReadFile(filePath)
126 if readErr != nil {
127 return nil, readErr
128 }
129 env, _ := os.ReadFile(path.Join(path.Dir(filePath), ".env"))
130 images, parseErr := docker.GetImagesFromDockerCompose(env, content)
131 if parseErr != nil {
132 return nil, fmt.Errorf("get compose images failed, cmd err: %v, parse err: %v", err, parseErr)
133 }
134 return images, nil
135}
136
137func getComposeImagesByCommand(filePath string) ([]string, error) {
138 if err := checkCmd(); err != nil {

Callers 1

pullComposeImagesFunction · 0.85

Calls 1

Tested by

no test coverage detected