Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在docker运行中将命令行参数作为env变量传递?_Docker_Dockerfile - Fatal编程技术网

如何在docker运行中将命令行参数作为env变量传递?

如何在docker运行中将命令行参数作为env变量传递?,docker,dockerfile,Docker,Dockerfile,我有一个docker映像bcgovimages/aries cloudagent:py36-1.14-1_0.5.1,为了运行它,我发出了以下命令: 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 --admi

我有一个docker映像
bcgovimages/aries cloudagent:py36-1.14-1_0.5.1
,为了运行它,我发出了以下命令:

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\"}"

我想将
--wallet storage config
--wallet storage creds
作为环境变量传递。我如何从
bcgovimages/aries cloudagent:py36-1.14-1_0.5.1
创建一个新映像,它将
--钱包存储配置
和--
钱包存储凭证作为环境变量,而不是命令行参数?

您可以在
Dockerfile
中使用
${…}
。使用
-e
描述
docker run
操作的环境变量

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}

docker run-d-p 5001:5000-p 10001:10000-e WALLET\u STORAGE\u CONFIG=“{”url\”:\“xx.xx.xxx.xxx:5432\”,“WALLET\u scheme\”:“DatabasePerWallet\”)-e WALLET\u STORAGE\u CREDS=“{”account\:“xxx\”,“password\”:“xxxx\”,“admin\u account\”,“admin\u\”:“postgres\”,“admin\u password\”:“xxxxx\”--“xxxxx\”--名称Postgrees1

使用
-e
标志。回答。在Docker文档中也很容易找到。