Azure 容器实例,yaml 文件在传递 json 值时不接受命令
Azure container instance, yaml files isnt accepting command when json value is passed
我正在尝试 运行 使用 YAML 文件和命令的容器 运行 图像是:
command: [
"/bin/bash",
"-c",
"python /home/indy/.pyenv/versions/3.6.9/bin/aca-py start -it http 0.0.0.0 10000 -ot http --admin 0.0.0.0 5000 --wallet-type indy --seed 10000000000000000000111111111110 --label Axis Test --admin-insecure-mode --log-level debug --wallet-storage-type postgres_storage --wallet-name test2 --wallet-storage-config "{\"url\":\"xx.xx.xxx.xxx:5432\",\"wallet_scheme\":\"DatabasePerWallet\"}" --wallet-storage-creds "{\"account\":\"xxxxxx\",\"password\":\"xxxxxxx\",\"admin_account\":\"postgres\",\"admin_password\":\"xxxxxxxxx\"}"",
]
我遇到了这个错误
Error while parsing yaml file:
while parsing a flow sequence
in "axis.yaml", line 9, column 16
expected ',' or ']', but got '{'
in "axis.yaml", line 12, column 331
wallet-storage-config 需要在双引号中传递,否则它会在 运行 显示图像时显示错误 Expecting property name enclosed in double quotes
。如果我在命令中用单引号替换双引号,则容器失败且没有日志
command: [
'/bin/bash',
'-c',
'python /home/indy/.pyenv/versions/3.6.9/bin/aca-py start -it http 0.0.0.0 10000 -ot http --admin 0.0.0.0 5000 --wallet-type indy --seed 10000test00000000000111111111110 --label Axis Test --admin-insecure-mode --log-level debug --wallet-storage-type postgres_storage --wallet-name test2 --wallet-storage-config "{\"url\":\"xx.xx.xxx.xxx:5432\",\"wallet_scheme\":\"DatabasePerWallet\"}" --wallet-storage-creds "{\"account\":\"xxxxxx\",\"password\":\"xxxxxx\",\"admin_account\":\"postgres\",\"admin_password\":\"xxxxxxx\"}"',
]
api-version: 2019-12-01
location: eastus
name: testcontainer
properties:
containers:
- name: ariesagent
properties:
image: bcgovimages/aries-cloudagent:py36-1.14-1_0.5.1
command: [
"/bin/bash",
"-c",
"python /home/indy/.pyenv/versions/3.6.9/bin/aca-py start -it http 0.0.0.0 10000 -ot http --admin 0.0.0.0 5000 --wallet-type indy --seed 10000000000000000000111111111110 --label 'Axis Test' --admin-insecure-mode --log-level debug --wallet-storage-type postgres_storage --wallet-name test2 --wallet-storage-config "{\"url\":\"xx.xx.xxx.xxx:5432\",\"wallet_scheme\":\"DatabasePerWallet\"}" --wallet-storage-creds "{\"account\":\"xxxxxx\",\"password\":\"xxxxxx\",\"admin_account\":\"postgres\",\"admin_password\":\"xxxxxx\"}"",
]
ports:
- port: 5000
protocol: TCP
- port: 10000
protocol: TCP
resources:
requests:
cpu: 1.0
memoryInGB: 1.5
ipAddress:
ports:
- port: 5000
protocol: TCP
- port: 10000
protocol: TCP
type: Public
dnsNameLabel: testcontainer-axis
osType: Linux
tags: null
type: Microsoft.ContainerInstance/containerGroups
docker 运行 命令
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\"}"
我可以通过在命令中将所需值作为 env 传递来解决它
command: [
"/bin/bash",
"-c",
"python /home/indy/.pyenv/versions/3.6.9/bin/aca-py start -it http 0.0.0.0 10000 -ot http --admin 0.0.0.0 5000 --wallet-type indy --seed 10000000000000000000111111111110 --label ${AGENT_NAME} --admin-insecure-mode --log-level debug --wallet-storage-type postgres_storage --wallet-name newwallet --wallet-storage-config ${WALLET_CONFIG} --wallet-storage-creds ${WALLET_CRED}",
]
然后传递那些环境变量
environmentVariables:
- name: AGENT_NAME
value: xxxxxx
- name: WALLET_CONFIG
value: "{\"url\":\"xxxxx.xxxxzurecontainer.io:5432\",\"wallet_scheme\":\"DatabasePerWallet\"}"
- name: WALLET_CRED
value: "{\"account\":\"xxxxx\",\"password\":\"xxxxx\",\"admin_account\":\"postgres\",\"admin_password\":\"xxxxxx\"}"
我正在尝试 运行 使用 YAML 文件和命令的容器 运行 图像是:
command: [
"/bin/bash",
"-c",
"python /home/indy/.pyenv/versions/3.6.9/bin/aca-py start -it http 0.0.0.0 10000 -ot http --admin 0.0.0.0 5000 --wallet-type indy --seed 10000000000000000000111111111110 --label Axis Test --admin-insecure-mode --log-level debug --wallet-storage-type postgres_storage --wallet-name test2 --wallet-storage-config "{\"url\":\"xx.xx.xxx.xxx:5432\",\"wallet_scheme\":\"DatabasePerWallet\"}" --wallet-storage-creds "{\"account\":\"xxxxxx\",\"password\":\"xxxxxxx\",\"admin_account\":\"postgres\",\"admin_password\":\"xxxxxxxxx\"}"",
]
我遇到了这个错误
Error while parsing yaml file:
while parsing a flow sequence in "axis.yaml", line 9, column 16 expected ',' or ']', but got '{' in "axis.yaml", line 12, column 331
Expecting property name enclosed in double quotes
。如果我在命令中用单引号替换双引号,则容器失败且没有日志
command: [
'/bin/bash',
'-c',
'python /home/indy/.pyenv/versions/3.6.9/bin/aca-py start -it http 0.0.0.0 10000 -ot http --admin 0.0.0.0 5000 --wallet-type indy --seed 10000test00000000000111111111110 --label Axis Test --admin-insecure-mode --log-level debug --wallet-storage-type postgres_storage --wallet-name test2 --wallet-storage-config "{\"url\":\"xx.xx.xxx.xxx:5432\",\"wallet_scheme\":\"DatabasePerWallet\"}" --wallet-storage-creds "{\"account\":\"xxxxxx\",\"password\":\"xxxxxx\",\"admin_account\":\"postgres\",\"admin_password\":\"xxxxxxx\"}"',
]
api-version: 2019-12-01
location: eastus
name: testcontainer
properties:
containers:
- name: ariesagent
properties:
image: bcgovimages/aries-cloudagent:py36-1.14-1_0.5.1
command: [
"/bin/bash",
"-c",
"python /home/indy/.pyenv/versions/3.6.9/bin/aca-py start -it http 0.0.0.0 10000 -ot http --admin 0.0.0.0 5000 --wallet-type indy --seed 10000000000000000000111111111110 --label 'Axis Test' --admin-insecure-mode --log-level debug --wallet-storage-type postgres_storage --wallet-name test2 --wallet-storage-config "{\"url\":\"xx.xx.xxx.xxx:5432\",\"wallet_scheme\":\"DatabasePerWallet\"}" --wallet-storage-creds "{\"account\":\"xxxxxx\",\"password\":\"xxxxxx\",\"admin_account\":\"postgres\",\"admin_password\":\"xxxxxx\"}"",
]
ports:
- port: 5000
protocol: TCP
- port: 10000
protocol: TCP
resources:
requests:
cpu: 1.0
memoryInGB: 1.5
ipAddress:
ports:
- port: 5000
protocol: TCP
- port: 10000
protocol: TCP
type: Public
dnsNameLabel: testcontainer-axis
osType: Linux
tags: null
type: Microsoft.ContainerInstance/containerGroups
docker 运行 命令
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\"}"
我可以通过在命令中将所需值作为 env 传递来解决它
command: [
"/bin/bash",
"-c",
"python /home/indy/.pyenv/versions/3.6.9/bin/aca-py start -it http 0.0.0.0 10000 -ot http --admin 0.0.0.0 5000 --wallet-type indy --seed 10000000000000000000111111111110 --label ${AGENT_NAME} --admin-insecure-mode --log-level debug --wallet-storage-type postgres_storage --wallet-name newwallet --wallet-storage-config ${WALLET_CONFIG} --wallet-storage-creds ${WALLET_CRED}",
]
然后传递那些环境变量
environmentVariables:
- name: AGENT_NAME
value: xxxxxx
- name: WALLET_CONFIG
value: "{\"url\":\"xxxxx.xxxxzurecontainer.io:5432\",\"wallet_scheme\":\"DatabasePerWallet\"}"
- name: WALLET_CRED
value: "{\"account\":\"xxxxx\",\"password\":\"xxxxx\",\"admin_account\":\"postgres\",\"admin_password\":\"xxxxxx\"}"