Docker run fails when kicking off via PR, but passes when ssh-ing in

ssh
docker
circle.yml

#1

Hi there,

I’m using circleci to checkout my repo on a circleci machine. I then use docker pull to pull an already build image from the Amazon Container Registery (it’s a blank Ubuntu 14.04 VM with R installed + R packages used by our repository) and use docker run to run a shell command on that pulled image.

This approach always breaks (when triggered via a pull request) on the docker run step. However, when rebuild with SSH access, using that SSH access and copy pasting the exact same command will perfectly install the repository and pass all unittests.

Why does this command work via logging in via SSH but not without ?

Here is my circle.yml:

machine:
  timezone:
    Europe/London

  python:
    version: 2.7.11

  services:
    - docker

dependencies:
  cache_directories:
    - "~/docker-cache"

  pre:
    # install aws cli interface
    - sudo apt-get install python-dev
    - pip install awscli

    # configure the aws default region
    - aws configure set default.region $AWS_LOCATION

  post:
    # build the docker image
    - docker info
    - aws ecr get-login --region $AWS_LOCATION > login_to_aws_docker.sh
    - sh login_to_aws_docker.sh
    - docker pull $AWS_ACCOUNT_ID.dkr.ecr.$AWS_LOCATION.amazonaws.com/$AWS_CONTAINER_REPO:latest

test:
  override:
    - docker images

    # run the tests in the container
    - docker run -u root --privileged -v `pwd`/$CIRCLE_PROJECT_REPONAME:/$HOME/$CIRCLE_PROJECT_REPONAME -w $HOME/$CIRCLE_PROJECT_REPONAME -ti $AWS_ACCOUNT_ID.dkr.ecr.$AWS_LOCATION.amazonaws.com/$AWS_CONTAINER_REPO:latest bash -c 'sudo mkdir -p installdir/usr/local/bin/ && sudo make install PREFIX=installdir && sudo make test'

#2