Docker error /bin/sh: eval: line 138: aws: not found

347 views Asked by At

When i try to execute this step in my ciccd pipeline i receive error :

/bin/sh: eval: line 138: aws: not found

It looks like it doesnt find my aws installation

Here is dockerfile where it is installed

# install glibc compatibility for alpine
RUN apk --no-cache add \
    binutils \
    curl \
    && apk add --no-cache \
    && curl -sL https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip \
    && unzip awscliv2.zip \
    && aws/install \
    && rm -rf \
    awscliv2.zip \
    aws \
    /usr/local/aws-cli/v2/*/dist/aws_completer \
    /usr/local/aws-cli/v2/*/dist/awscli/data/ac.index \
    /usr/local/aws-cli/v2/*/dist/awscli/examples \
    && apk --no-cache del \
    binutils \
    curl


ENV PYTHONUNBUFFERED=1
RUN apk add --update --no-cache python3 build-base zlib-dev openssl-dev libffi-dev gcc python3-dev && ln -sf python3 /usr/bin/python
RUN apk add --update --no-cache curl && curl -sSL https://install.python-poetry.org | python - -y && apk --no-cache del curl
ENV PATH=/root/.local/bin:$PATH

Here is the step defined in my cicd.yml

.service-talk-booking-docker-image:
  image: registry.gitlab.com/<gitlab_id>/talk-booking:cicd-docker
  stage: docker
  services:
    - docker:23.0.5-dind
  before_script:
    - cd services/talk_booking/
    - poetry export --without-hashes --with-credentials -f requirements.txt > requirements.txt
    - aws --version
    - aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin <account_id>.dkr.ecr.eu-west-1.amazonaws.com
  script:
    - docker build --pull -t "$DOCKER_IMAGE_TAG" .
    - docker push "$DOCKER_IMAGE_TAG"

service-talk-booking-docker-image-development:
  extends: .service-talk-booking-docker-image
  variables:
    DOCKER_IMAGE_TAG: https://<account_id>.dkr.ecr.eu-west-1.amazonaws.com:development-$CI_COMMIT_SHA
  only:
    refs:
      - merge_requests
      - master
    changes:
      - services/talk_booking/**/*

Here is the error stacktrace

$ cd services/talk_booking/
$ poetry export --without-hashes --with-credentials -f requirements.txt > requirements.txt
/bin/sh: eval: line 138: aws: not found
$ export PATH=$PATH:/root/.local/bin/
$ aws --version
Cleaning up project directory and file based variables
ERROR: Job failed: exit code 127
0

There are 0 answers