Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

GCP App Engine, Docker for windows, asp.net core and Cloudstore NoSQL

Options
  • 18-06-2019 3:16pm
    #1
    Registered Users Posts: 772 ✭✭✭


    I have an app engine instance running on GCP and a sample app which I can run directly from Visual studio (Windows) and I can update the cloudstore db. I can also deploy the app to GCP.

    I need an authentication key to access the service account in GCP from docker, so I've added it to the project in SweepstakesLinux/Keys so the so it gets copied to docker by the dockerfile.

    However when I try to run it in Docker, I get this error
    : 'Error reading credential file from location /app/SweepstakesLinux/Keys/KEY_NAME.json: Could not find file '/app/SweepstakesLinux/Keys/KEY_NAME.json'.
    

    My Dockerfile looks like this
    FROM gcr.io/google-appengine/aspnetcore:2.1
    COPY . /app
    WORKDIR /app
    
    # Environment Variables
    ENV GOOGLE_APPLICATION_CREDENTIALS /app/SweepstakesLinux/Keys/KEY_NAME.json
    
    
    ENTRYPOINT ["dotnet", "SweepstakesLinux.dll"]
    

    I can connect to the docker image using
    docker run -it --entrypoint sh sweepstakeslinux:dev
    
    and I can see the file exists in the directory.

    483023.png

    If I run $GOOGLE_APPLICATION_CREDENTIALS from the docker container, it seems to find the file, but not the fields in it
    483024.png

    and if I run grep vi $GOOGLE_APPLICATION_CREDENTIALS it can open the file but some of the key value pairs seem to be missing:
    483025.png

    I've also tried mounting a local folder from my PC to access and copy the key from there by running
    docker run -v C:\Users\Phil\Keys:/keys --entrypoint sh sweepstakeslinux:dev
    

    but it just results in this error:
    No executable found matching command "dotnet-SweepstakesLinux.dll"

    Any ideas?


Comments

  • Registered Users Posts: 772 ✭✭✭pillphil


    Changing the docker file to this works, but Im not sure if it's correct.
    	FROM gcr.io/google-appengine/aspnetcore:2.1
    	COPY . /app
    	WORKDIR /app
    	RUN mkdir /tmp/keys
    
    	RUN cp /app/SweepstakesLinux/Keys/dbAccessKey.json /tmp/keys/dbAccessKey.json
    
    	ENV GOOGLE_APPLICATION_CREDENTIALS  /tmp/keys/dbAccessKey.json
    
    
    	ENTRYPOINT ["dotnet", "SweepstakesLinux.dll"]
    
    


Advertisement