mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 03:07:20 +08:00
fix: 防止清除面板创建的网络
This commit is contained in:
@@ -339,6 +339,8 @@ func (r *containerRepo) Prune() error {
|
||||
}
|
||||
defer func(apiClient *client.Client) { _ = apiClient.Close() }(apiClient)
|
||||
|
||||
_, err = apiClient.ContainerPrune(context.Background(), client.ContainerPruneOptions{})
|
||||
_, err = apiClient.ContainerPrune(context.Background(), client.ContainerPruneOptions{
|
||||
Filters: make(client.Filters).Add("label", "created_by!=acepanel"),
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -132,6 +132,8 @@ func (r *containerImageRepo) Prune() error {
|
||||
}
|
||||
defer func(apiClient *client.Client) { _ = apiClient.Close() }(apiClient)
|
||||
|
||||
_, err = apiClient.ImagePrune(context.Background(), client.ImagePruneOptions{})
|
||||
_, err = apiClient.ImagePrune(context.Background(), client.ImagePruneOptions{
|
||||
Filters: make(client.Filters).Add("label", "created_by!=acepanel"),
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -161,6 +161,8 @@ func (r *containerNetworkRepo) Prune() error {
|
||||
}
|
||||
defer func(apiClient *client.Client) { _ = apiClient.Close() }(apiClient)
|
||||
|
||||
_, err = apiClient.NetworkPrune(context.Background(), client.NetworkPruneOptions{})
|
||||
_, err = apiClient.NetworkPrune(context.Background(), client.NetworkPruneOptions{
|
||||
Filters: make(client.Filters).Add("label", "created_by!=acepanel"),
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -99,6 +99,8 @@ func (r *containerVolumeRepo) Prune() error {
|
||||
}
|
||||
defer func(apiClient *client.Client) { _ = apiClient.Close() }(apiClient)
|
||||
|
||||
_, err = apiClient.VolumePrune(context.Background(), client.VolumePruneOptions{})
|
||||
_, err = apiClient.VolumePrune(context.Background(), client.VolumePruneOptions{
|
||||
Filters: make(client.Filters).Add("label", "created_by!=acepanel"),
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user