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

Method DeleteContainerFile

agent/app/service/container.go:1244–1260  ·  view source on GitHub ↗
(req dto.ContainerFileBatchDeleteReq)

Source from the content-addressed store, hash-verified

1242}
1243
1244func (u *ContainerService) DeleteContainerFile(req dto.ContainerFileBatchDeleteReq) error {
1245 for _, item := range req.Paths {
1246 if strings.TrimSpace(item) == "/" {
1247 return buserr.New("ErrPathNotDelete")
1248 }
1249 }
1250 cli, err := docker.NewDockerClient()
1251 if err != nil {
1252 return err
1253 }
1254 defer cli.Close()
1255
1256 command := []string{"rm", "-rf", "--"}
1257 command = append(command, req.Paths...)
1258 _, err = runContainerCommand(cli, req.ContainerID, command)
1259 return err
1260}
1261
1262func (u *ContainerService) UploadContainerFile(req dto.ContainerFileReq, fileName string, fileSize int64, file io.Reader) error {
1263 if len(req.Path) == 0 {

Callers

nothing calls this directly

Calls 2

runContainerCommandFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected