title: docker compose failing on gitlab-ci build stage
body: <p>I am trying to build gitlab-ci but one of the stages is failing the build. I get stuck on build stage. it does not recognise python and i am trying to install it so i can build the image and get it tested with robot framework</p>
  <p><strong>gitlab-ci.yaml</strong></p>
  <pre><code>image: python:latest
  
  services:
    - name: docker:dind
      entrypoint: [&quot;env&quot;, &quot;-u&quot;, &quot;DOCKER_HOST&quot;]
      command: [&quot;dockerd-entrypoint.sh&quot;]
  
  stages:
    - compile
    - build
    - test
    - deploy
  
  variables:
    DOCKER_HOST: tcp://docker:2375
    DOCKER_DRIVER: overlay2
    DOCKER_TLS_CERTDIR: &quot;&quot;
    MOUNT_POINT: /builds/$CI_PROJECT_PATH/mnt
    REPOSITORY_URL: $AWS_ACCOUNT_ID.dkr.ecr.eu-west-2.amazonaws.com/apps_web
    TASK_DEFINITION_NAME: apps_8000
    CLUSTER_NAME: QA-2
    SERVICE_NAME: apps_demo
    ARTIFACT_REPORT_PATH: &quot;app/reports/&quot;
  
  before_script:
    - docker info
    - export IMAGE=$CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME
    - export WEB_IMAGE=$IMAGE:web
    - apk add --no-cache openssh-client bash
    - chmod +x ./setup_env.sh
    - bash ./setup_env.sh
    - docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
  
  unittests:
    stage: test
    before_script:
      - python -m venv env
      - source env/bin/activate
      - python -m pip install --upgrade pip
      - pip install -r app/app-requirements.txt
    variables:
      DOCKER_IMAGE_TAG: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}
    image: ${DOCKER_IMAGE_TAG}
    script:
      - source env/bin/activate
      - python app/manage.py jenkins --enable-coverage
    artifacts:
      reports:
        junit: app/reports/junit.xml
      paths:
        - $ARTIFACT_REPORT_PATH
      expire_in: 30 days
      when: on_success
    only:
      refs:
        - merge_requests
      variables:
        - $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == &quot;qa&quot;
  
  migrations:
    stage: compile
    before_script:
      - python -m venv env
      - source env/bin/activate
      - pip install -r app/app-requirements.txt
    script:
      - python app/manage.py makemigrations
    artifacts:
      paths:
        - &quot;app/*/migrations/*.py&quot;
      expire_in: 1 day
    only:
      refs:
        - merge_requests
      variables:
        - $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == &quot;qa&quot;
  
  build:
    image:
      name: docker/compose:1.25.4
      entrypoint: [ &quot;&quot; ]
    stage: build
    variables:
      DOCKER_IMAGE_TAG: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}
    before_script:
      - apt-get install python3
      - python -m venv env
      - source env/bin/activate
      - python -m pip install --upgrade pip
      - pip install -r app/app-requirements.txt
      - export IMAGE=$CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME
      - export WEB_IMAGE=$IMAGE:web
    script:
      - apk add --no-cache bash
      - chmod +x ./setup_env.sh
      - bash ./setup_env.sh
      - docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
      - docker pull $IMAGE:web || true
      - docker-compose -f docker-compose.ci.yml build
      - docker push $IMAGE:web
      - docker tag app
      - docker build -t ${DOCKER_IMAGE_TAG} .
    after_script:
      - docker push ${DOCKER_IMAGE_TAG}
      - docker logout
    dependencies:
      - migrations
    only:
      refs:
        - merge_requests
      variables:
        - $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == &quot;qa&quot;
  
  deploy_qa:
    stage: deploy
    image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-ecs:latest
    before_script:
      - export IMAGE=$CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME
      - export WEB_IMAGE=$IMAGE:web
      - docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
    script:
      - echo $IMAGE
      - echo $WEB_IMAGE
      - docker pull $WEB_IMAGE
    environment:
      name: qa
      url: https://app.domain.com
    only:
      refs:
        - merge_requests
      variables:
        - $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == &quot;qa&quot;
  </code></pre>
  <p>It is failing with error <code>/bin/sh: eval: line 153: apt-get: not found</code></p>