I have a python script to update ECR images in my repo and keep a couple previous images as well in case of errors in new ones. I'm trying to run this from my buildspec yml file in Codebuild but it's not executing correctly. Below are the relevant lines in buildspec and in my py script.
build:
commands:
- echo Updating previous images in ECR repo
- python3 UpdateECRImages.py
run(f"docker pull {image_string}grafana-1")
The run command is imported from subprocess and this whole script works as intended locally. I've also tried just running that ecr command in the buildspec file to verify the correct IAM permissions are in place as well and that executes without error. However when I run it, in Codebuild, throws an error: FileNotFoundError: [Errno 2] No such file or directory: 'docker pull ############.dkr.ecr.us-east-1.amazonaws.com/#########:grafana-1'
Once again I can run these docker commands from the buildspec file but not from the py script in the buildspec file and unsure why. Any help is appreciated.