vendredi 26 juin 2015

docker - cannot find aws credentials in container although they exist

Running the following docker command on mac works and on linux, running ubuntu cannot find the aws cli credentials. It returns the following message: Unable to locate credentials Completed 1 part(s) with ... file(s) remaining

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.

sudo docker run -it --rm -v ~/.aws:/root/.aws username/docker-image sh -c 'aws s3 cp s3://bucketname/filename.tar.gz /home/emailer && cd /home/emailer && tar zxvf filename.tar.gz && /bin/bash'

What am I missing here?

This is my Dockerfile:

FROM ubuntu:latest

#install node and npm
RUN apt-get update && \
    apt-get -y install curl && \
    curl -sL http://ift.tt/1oa11OK | sudo bash - && \
    apt-get -y install python build-essential nodejs

#install and set-up aws-cli
RUN sudo apt-get -y install \
    git \
    nano \
    unzip && \
    curl "http://ift.tt/1qk3Vnt" -o "awscli-bundle.zip" && \
    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 && npm install
RUN mkdir -p /home/emailer && cp -a /tmp/node_modules /home/emailer/




Aucun commentaire:

Enregistrer un commentaire