gpt4 book ai didi

javascript - 如何通过 API 启动 hyper.sh 容器? (接收“执行失败 : no such file or directory error)

转载 作者:行者123 更新时间:2023-11-30 21:06:09 27 4
gpt4 key购买 nike

我正在使用 hyper.sh 构建一个 JS 评分应用程序。当我通过 API 创建容器时,指定的命令在我尝试启动它时没有运行(通过 API 或 CLI)。相反,'exec failed: no such file or directory 被写入日志。

我首先使用 axios 根据/containers/create 文档创建一个容器。我在这里缩短了一些内容,但它与文档中提供的正文相同。

var createOptions = {
url: 'https://us-west-1.hyper.sh/containers/create',
method: 'POST',
credential: {
accessKey: '...',
secretKey: '...'
},
body: {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": true,
"AttachStderr": true,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Cmd":[
"date"
],
"Entrypoint": "",
"Image": "ubuntu",
"Labels": {
"com.example.vendor": "Acme",
"com.example.license": "GPL",
"com.example.version": "1.0",
"sh_hyper_instancetype": "s4"
},
"WorkingDir": "",
"NetworkDisabled": false,
"ExposedPorts": {
"22/tcp": {}
},
"StopSignal": "SIGTERM",
"HostConfig": {
...
}
}
}

接下来,我运行 hyper start $(id)。记录了容器 ID,但未运行 Cmd 中指定的命令。任何正在发生的事情的想法将不胜感激。 感谢您的帮助。

最佳答案

可以通过从容器选项中删除 "Entrypoint": "", 来修复此错误。

有关其他信息,似乎 ENTRYPOINT 和 CMD 是相关的,同时使用两者是多余的。我在 hyper API 文档中提出了一个问题以进行澄清。

关于javascript - 如何通过 API 启动 hyper.sh 容器? (接收“执行失败 : no such file or directory error),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46570927/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com