2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 10:17:17 +08:00

feat: 优化docker兼容

This commit is contained in:
耗子
2024-10-31 03:28:41 +08:00
parent 52e8830605
commit f01afacf34
13 changed files with 107 additions and 49 deletions

View File

@@ -110,17 +110,17 @@ func (r *containerNetworkRepo) Create(req *request.ContainerNetworkCreate) (stri
sb.WriteString(fmt.Sprintf(" --opt %s=%s", option.Key, option.Value))
}
return shell.ExecfWithTimeout(30*time.Second, sb.String()) // nolint: govet
return shell.ExecfWithTimeout(120*time.Second, sb.String()) // nolint: govet
}
// Remove 删除网络
func (r *containerNetworkRepo) Remove(id string) error {
_, err := shell.ExecfWithTimeout(30*time.Second, "docker network rm -f %s", id)
_, err := shell.ExecfWithTimeout(120*time.Second, "docker network rm -f %s", id)
return err
}
// Prune 清理未使用的网络
func (r *containerNetworkRepo) Prune() error {
_, err := shell.ExecfWithTimeout(30*time.Second, "docker network prune -f")
_, err := shell.ExecfWithTimeout(120*time.Second, "docker network prune -f")
return err
}