0

I have a docker image bcgovimages/aries-cloudagent:py36-1.14-1_0.5.1 and to run it I gave the following command:

docker run -d -p 5001:5000 -p 10001:10000 --name postgrearies1 bcgovimages/aries-cloudagent:py36-1.14-1_0.5.1 start -it http 0.0.0.0 10000 -ot http --admin 0.0.0.0 5000 --admin-insecure-mode --seed 10000000000000000000111111111110 --wallet-type indy --log-level debug --storage-type indy --wallet-storage-type postgres_storage --wallet-name test2 --wallet-storage-config "{\"url\":\"xx.xx.xxx.xxx:5432\",\"wallet_scheme\":\"DatabasePerWallet\"}" --wallet-storage-creds "{\"account\":\"xxx\",\"password\":\"xxxx\",\"admin_account\":\"postgres\",\"admin_password\":\"xxxxx\"}"

I want to pass --wallet-storage-config and --wallet-storage-creds as environment variables. How can I create a new image from bcgovimages/aries-cloudagent:py36-1.14-1_0.5.1 which will take --wallet-storage-config and --wallet-storage-creds as environment variables instead of a command-line argument?

It'sNotMe
  • 1,184
  • 1
  • 9
  • 29
yatharth meena
  • 369
  • 4
  • 13
  • Use the `-e` flag. Answered [here](https://stackoverflow.com/questions/30494050/how-do-i-pass-environment-variables-to-docker-containers). Easily found in the Docker docs also. – Ryan Dec 16 '20 at 07:39

1 Answers1

1

You can use ${...} in your Dockerfile. Use -e for describing environment variables for docker run operation.

Dockerfile

FROM bcgovimages/aries-cloudagent:py36-1.14-1_0.5.1 

ENTRYPOINT start -it http 0.0.0.0 10000 -ot http --admin 0.0.0.0 5000 --admin-insecure-mode --seed 10000000000000000000111111111110 --wallet-type indy --log-level debug --storage-type indy --wallet-storage-type postgres_storage --wallet-name test2 --wallet-storage-config ${WALLET_STORAGE_CONFIG} --wallet-storage-creds ${WALLET_STORAGE_CREDS}

Shell

docker run -d -p 5001:5000 -p 10001:10000 -e WALLET_STORAGE_CONFIG="{\"url\":\"xx.xx.xxx.xxx:5432\",\"wallet_scheme\":\"DatabasePerWallet\"}" -e WALLET_STORAGE_CREDS="{\"account\":\"xxx\",\"password\":\"xxxx\",\"admin_account\":\"postgres\",\"admin_password\":\"xxxxx\"}" --name postgrearies1 
Ismail Durmaz
  • 2,521
  • 1
  • 6
  • 19