0

I'm running into an issue with a custom Docker image. I've installed a number of tools and all seem to be working except for the AWSCLI.

I install here:

RUN apt-get install -y \
        python \
        python-pip \
        groff \
        less \
        mime-support \
        && \
    pip install --upgrade awscli==1.14.5 s3cmd==2.0.1 python-magic && \
    apt-get -v del python-pip && \
    rm -rf /var/cache/apt/*
VOLUME /root/.aws

Which installs successfully, I even ran aws --version to confirm no errors. Then when running in .gitlab-ci.yml aws is not recognized but my other tools are.

Here is the command I'm running:

aws ec2 describe-instances --filters "Name=tag:Project,Values=" --region us-east-2 --query "Reservations[].Instances[].[PrivateIpAddress]" --output=text

This is the error I get:

/bin/sh: eval: line 132: aws: not found
TravelingLex
  • 399
  • 1
  • 3
  • 16
  • are you sure you're running with your custom docker image? have you tried installing other command-line tools and verified that they are installed properly? – jeremysprofile Jul 25 '20 at 15:37
  • Yes I'm able to run the other tools that I've installed (terraform, terragrunt, ansible) – TravelingLex Jul 26 '20 at 16:02

1 Answers1

0

Core of your problem is same as in this question:

awscli not added to path after installation

Python of specific version was installed and it's /bin folder is not in system executable path. You need to add your Python version to system PATH:

ENV PATH "$PATH:/Library/Frameworks/Python.framework/Versions/3.8/bin" 

Other variant: install only py-pip and it will fetch python and install aws globally, DO not remove py-pip after, or it will clean references to aws.

KorbenDallas
  • 944
  • 9
  • 16