Sign inSign up

babacoders/baba-new-env

By babacoders

•Updated almost 9 years ago

This is the demo image to dynamically change env variables on docker containers

Image
0

247

babacoders/baba-new-env repository overview

Demo Setup:

Pull the image on your local machine by running the following command

⁠docker pull babacoders/baba-new-env

Also along with it , please download the git repository from babacoders but dont build any image (New Code is not merged to it , we are just cloning it to get json files , rest all code is merged to the image up pulled in the above step )

⁠git clone https://github.com/babacoders/kishore-win-docker2.git⁠

Create a folder under your C: drive and only copy both the json files to it

⁠mkdir C:/baba

Run the command mentioned below and you can see the env variables are changed. -v option is for mounting local host folder to your container Try removing any one json file from folder "baba" and try running the command with that file name , it will throw error . This command below is just for demo

⁠docker run --rm -it -v C:/baba:C:/json baba-new-env python read.py -f C:/json/test1.json

Now for the actual use comes from below commands as the container will run in detached mode and changes the env variables after going into interactive bash mode to container

⁠docker run -itd -v C:/baba:C:/json baba-new-env

Get the container id by running the below command

⁠docker ps

Run the below command to access the container

⁠docker exec -it powershell

After running the above command you will see(powershell promt with working dir as kishore PS C:\kishore>) . Run the below command in powershell and change the env variables to your container . Now keep adding the json files to your host folder "baba" and try running the cmd with the required json files .

⁠python.exe .\read.py -f C:\json\test2.json

Tag summary

Content type

Image

Digest

Size

5 GB

Last updated

almost 9 years ago

docker pull babacoders/baba-new-env