🎨 Docker 容器限制 CPU 和内存

This commit is contained in:
Liang Ding 2021-03-05 20:09:37 +08:00
parent 3a4aabc297
commit 2e53a02446
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D
1 changed files with 1 additions and 1 deletions

View File

@ -69,7 +69,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request, channel map[string]*util
if conf.Docker {
fileName := filepath.Base(filePath)
cmd = exec.Command("docker", "run", "--rm", "--name", rid, "-v", filePath+":/"+fileName, conf.DockerImageGo,
"-m", "64M", "--cpus", "0.1", "/"+fileName)
"--memory", "64M", "--cpus", "0.1", "/"+fileName)
} else {
cmd = exec.Command(filePath)
curDir := filepath.Dir(filePath)