Docker run complains no such file or directory

Scenario
Execute AWS-CLI docker container via Jenkin job to get status of EC2 instance, to be displayed on monitor

Steps Taken

  1. Created Jenkins job
  2. Executed AWS-CLI docker contair received response as a Json
  3. Challenge is to parse received Json via jq or awk, <– Failing in this step

Execution Script

`docker run --rm -v $VOLUME_AWS_CRED -v $VOLUME_FILE_STORAGE amazon/aws-cli  ec2 describe-instance-status --region $AWS_DEFAULT_REGION --profile $AWS_PROFILE --include-all-instances --instance-ids  $INSTANCE_ID` > /root/aws/ec2_instancestatus.json

Written outcome above to ec2_instancestatus.json

`docker run --rm -v $VOLUME_FILE_STORAGE imega/jq '.InstanceStatuses[0].InstanceState.Name' /root/aws/ec2_instancestatus.json`

ERROR :: /tmp/jenkins6177799219393082837.sh: line 163: /root/aws/ec2_instancestatus.json: No such file or directory

Stack Details:

  • Jenkin job executing on Docker Container on an agent node.
  • Shell script bash style
  • jq json parser

Source: StackOverflow