gpt4 book ai didi

amazon-web-services - docker 错误 - "jq: error: Cannot iterate over null"

转载 作者:IT老高 更新时间:2023-10-28 12:37:45 29 4
gpt4 key购买 nike

所以我试图在 Elastic Beanstalk 上部署一个 dockerfile,但我无法克服这个错误 - “jq: error: Cannot iterate over null”。

Successfully built [myContainerId]
Successfully built aws_beanstalk/staging-app
[2015-01-29T10:35:59.494Z] INFO [16343] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/04run.sh] : Starting activity...
[2015-01-29T10:36:05.507Z] INFO [16343] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/04run.sh] : Activity execution failed, because: command failed with error code 1: /opt/elasticbeanstalk/hooks/appdeploy/pre/04run.sh
jq: error: Cannot iterate over null
Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Thu Jan 29 10:36:05 UTC 2015:. Check snapshot logs for details. (Executor::NonZeroExitStatus)
at /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/executor-1.0/lib/executor/exec.rb:81:in `sh'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/executor-1.0/lib/executor.rb:15:in `sh'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/executable.rb:63:in `execute!'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/hook-directory-executor.rb:29:in `block (2 levels) in run!'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `call'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `exec'

日志中没有任何其他错误。我的 Docker 容器已成功构建,因此错误似乎不太可能来自那里。

我的 Dockerrun.aws.json 看起来像:

   {
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "blah",
"Update": "false"
},
"Ports": [
{
"ContainerPort": "8080"
}
]
}

我正用这个把头撞到墙上,我所做的任何改变似乎都不会影响它,谷歌搜索也没有任何帮助。

有什么想法吗?

最佳答案

如果其他人正在寻找如何避免在他们自己的 jq 命令中出现 Cannot iterate over null 错误,请在 [] 之后添加一个问号。例如

echo '{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "blah",
"Update": "false"
},
"Ports": [
{
"ContainerPort": "8080"
}
]
}'|jq -c '.Volumes[]?|[.HostDirectory,.ContainerDirectory]'

其中 [] 被替换为 []? 不显示错误。

来自手册:

.[]?
Like .[], but no errors will be output if . is not an array or object.

关于amazon-web-services - docker 错误 - "jq: error: Cannot iterate over null",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28213232/

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