docker / dev-environments

60 stars 32 forks source link

How to get credentials, e.g. .aws/credentials, into a devenv that is shared #109

Open bill-salvucci-experoinc-com opened 2 years ago

bill-salvucci-experoinc-com commented 2 years ago

Description

I'd like to share a docker dev environment with all the tooling needed for our project installed and configured. We've done this by initially creating a docker dev env from git clone of our repo. we installed a bunch of stuff into that and then used "Share" in Docker Desktop Dev Environments to push an image to our hub.docker.com repo as :latest. Now all the team members create a dev environment for themselves in Docker Desktop Dev Environments from that image :latest. Works fine. All team member now have python, poetry, aws cli, etc installed and configured appropriately for the project.

~/.aws/credentials which was set in the original dev environment is not in the image, which is a good thing. But I'm not understanding how to do things like mount a host path when running the dev environment container. I haven't found any configuration files for the dev environment that allows me to do those types of things when the dev environment container runs.

Steps to reproduce the issue:

  1. create dev environment from Docker Desktop from git clone
  2. install aws cli
  3. aws configure to set your aws accessid and secret
  4. share dev environment image
  5. create dev envrionment from Docker Desktop using hub.docker.com repo that was shared in 4
  6. execute any aws command that requires credentials

Describe the results you received: aws cli command fails with unauthorized error

Describe the results you expected: use mount to .aws/credentials on the host

Version of Docker Desktop:
Version

4.6.0 (75818)

Engine: 20.10.13

Compose: 1.29.2

Credential Helper: 0.6.4

Kubernetes: v1.22.5

Snyk: v1.827.0

Additional environment details (AWS ECS, Azure ACI, local, etc.): mac