Skip to content

POC for reading env variable in Docker container using Bottle framework

License

Notifications You must be signed in to change notification settings

nikhilakki/docker-env-poc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Env POC

A POC for passing an Env variable to a docker container and reading it in the application.

  • A simple Python web app containerized using Docker
  • Endpints -
    • /ping # returns pong
    • /env # returns ENV_VAR value passed during docker run

How to run?

# Step 0 - Display CLI options
./docker-helper.sh
# o/p - CLI options, choose from build | run | run-env | clean
# Step 1 - Build docker container image
./docker-helper.sh build
# Step 2 - Run docker container without setting ENV_VAR
./docker-helper.sh run
# Step 3 - Run docker container with value passed in ENV_VAR; it is picked up from 2nd arg (value in "")
./docker-helper.sh run-env "this-is-coming-from-env-var"

Finally open http://0.0.0.0:8080/env

Run AWS CLI configuration

  • Create a file .env in the repo root and add configuration in following format
    AWS_ACCESS_KEY_ID=xxxx
    AWS_SECRET_ACCESS_KEY=xxxx
    AWS_DEFAULT_REGION=us-east-1
    ENV_VAR=Sample-env
    
  • Run
    # Run docker container with AWS CLI configuration
    ./docker-helper.sh run-env-file
  • Visit http://0.0.0.0:8080/buckets

Reference documentation

Author

License - MIT

About

POC for reading env variable in Docker container using Bottle framework

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published