title: docker - cannot find aws credentials in container although they exist
body: <p>Running the following docker command on <code>mac</code> works and on <code>linux</code>, running <code>ubuntu</code> cannot find the <code>aws cli</code> credentials. It returns the following message: <code>Unable to locate credentials
  Completed 1 part(s) with ... file(s) remaining</code></p>
  
  <p>The command which runs an image and mounts a data volume and then copies a file from and s3 bucket, and starts the bash shell in the docker container.</p>
  
  <p><code>sudo docker run -it --rm -v ~/.aws:/root/.aws username/docker-image sh -c 'aws s3 cp s3://bucketname/filename.tar.gz /home/emailer &amp;&amp; cd /home/emailer &amp;&amp; tar zxvf filename.tar.gz &amp;&amp; /bin/bash'</code></p>
  
  <p>What am I missing here?</p>
  
  <p>This is my <code>Dockerfile</code>:</p>
  
  <pre><code>FROM ubuntu:latest
  
  #install node and npm
  RUN apt-get update &amp;&amp; \
      apt-get -y install curl &amp;&amp; \
      curl -sL https://deb.nodesource.com/setup | sudo bash - &amp;&amp; \
      apt-get -y install python build-essential nodejs
  
  #install and set-up aws-cli
  RUN sudo apt-get -y install \
      git \
      nano \
      unzip &amp;&amp; \
      curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" &amp;&amp; \
      unzip awscli-bundle.zip
  
  RUN sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
  
  # Provides cached layer for node_modules
  ADD package.json /tmp/package.json
  RUN cd /tmp &amp;&amp; npm install
  RUN mkdir -p /home/emailer &amp;&amp; cp -a /tmp/node_modules /home/emailer/
  </code></pre>