devsapp / fc3

fc3.0 组件
MIT License
13 stars 5 forks source link

无法杀死启动的自定义容器 #15

Closed ghostoy closed 3 weeks ago

ghostoy commented 1 month ago

ctrl-c的时候报错,不能杀死容器。

[2024-09-12 15:17:24][DEBUG] Incoming access alias is default
[2024-09-12 15:17:24][DEBUG] The converted access alias is default
[2024-09-12 15:19:51][DEBUG] Process SIGINT

Error Message:
Command failed: docker ps -a | grep [object Promise] | awk '{print $1}' | xargs docker kill
grep: Unmatched [, [^, [:, [., or [=
"docker kill" requires at least 1 argument.
See 'docker kill --help'.

Usage:  docker kill [OPTIONS] CONTAINER [CONTAINER...]

Kill one or more running containers

[2024-09-12 15:19:51][DEBUG] Error: Command failed: docker ps -a | grep [object Promise] | awk '{print $1}' | xargs docker kill
grep: Unmatched [, [^, [:, [., or [=
"docker kill" requires at least 1 argument.
See 'docker kill --help'.

Usage:  docker kill [OPTIONS] CONTAINER [CONTAINER...]

Kill one or more running containers

    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at checkExecSyncError (node:child_process:890:11)
    at execSync (node:child_process:962:15)
    at /home/liuco/.local/share/pnpm/global/5/.pnpm/@serverless-devs+s@3.1.1/node_modules/@serverless-devs/s/lib/index.js:281:1456
    at m9e (/home/liuco/.local/share/pnpm/global/5/.pnpm/@serverless-devs+s@3.1.1/node_modules/@serverless-devs/s/lib/index.js:281:422)
    at Wd.execSync (/home/liuco/.local/share/pnpm/global/5/.pnpm/@serverless-devs+s@3.1.1/node_modules/@serverless-devs/s/lib/index.js:281:1437)
    at process.<anonymous> (/home/liuco/.s/components/devsapp.cn/v3/fc3/dist/index.js:333:235952)
    at process.emit (node:events:531:35)
    at process.emit (node:domain:488:12)

A complete log of this run can be found in: /home/liuco/.s/logs/0912151724

Env:       @serverless-devs/s: 3.1.1, linux-x64 node-v20.14.0                                    
Logs:      /home/liuco/.s/logs/0912151724                                                        
Feedback:  https://github.com/Serverless-Devs/Serverless-Devs/issues                             

[2024-09-12 15:19:49][DEBUG] Run traceid: 0912151724

错误定位到这里,没有使用await来调用异步函数getRuntimeRunImage,导致这个错误。 https://github.com/devsapp/fc3/blob/c402e2806e289cfe2467d710bae25ec61e2b6728/src/subCommands/local/impl/start/customContainerLocalStart.ts#L53-L63