I'm a bit new to Docker and I'm trying to copy resources from my cloud bucket to my instance created with a docker image. I use gsutil
with the following in my Dockerfile
# Install Google Cloud tools - Debian https://cloud.google.com/storage/docs/gsutil_install#deb
ENV CLOUD_SDK_REPO="cloud-sdk-stretch"
RUN echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | \
tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
apt-get update && apt-get install -y google-cloud-sdk
# Setup Google Service Account
COPY service-account.json /etc/
ENV GOOGLE_APPLICATION_CREDENTIALS="/etc/service-account.json"
RUN gcloud auth activate-service-account --key-file=${GOOGLE_APPLICATION_CREDENTIALS}
# Copy the last updated ssl config
RUN gsutil cp -r gs://my-project.appspot.com/docker/etc/letsencrypt /etc/ && \
gsutil cp -r gs://my-project.appspot.com/docker/etc/apache2/sites-available /etc/apache2/
When I run this on my machine locally, the files get copied correctly with gsutil. (They exist when I run the docker image)
When I deploy to Google Container Registry and Use the docker image on a GCE instance the files don't exist on the running docker image.
I can see from the google build logs that the gsutil appears to be working correctly and is copying the files (during the build process).
What am I doing wrong? Is this a bug?
Any help appreciated!