So I\'m trying to deploy a dockerfile on Elastic Beanstalk, but I can\'t get past this error - \"jq: error: Cannot iterate over null\".
Successfully built [
If others are looking for how to avoid the Cannot iterate over null error in their own jq commands, add a question mark after []. For example
echo '{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "blah",
"Update": "false"
},
"Ports": [
{
"ContainerPort": "8080"
}
]
}'|jq -c '.Volumes[]?|[.HostDirectory,.ContainerDirectory]'
where [] was replaced with []? does not display the error.
From the manual:
.[]?
Like .[], but no errors will be output if . is not an array or object.