首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Azure容器实例,当传递json值时,yaml文件不接受命令

Azure容器实例,当传递json值时,yaml文件不接受命令
EN

Stack Overflow用户
提问于 2020-12-15 11:15:07
回答 1查看 476关注 0票数 0

我试图使用YAML文件和命令运行一个容器,以运行映像:

代码语言:javascript
复制
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\"}"",
]

我收到了这个错误

解析yaml文件时

错误:在"axis.yaml“中解析流序列时,第9行第16列期望',‘或’],但在"axis.yaml”中得到'{‘,第12行,第331列

钱包-存储-配置需要传入双引号,其他明智的,它会显示错误时,运行图像作为它的Expecting property name enclosed in double quotes。如果我用命令中的单引号替换双引号,则容器在没有日志时失败。

代码语言:javascript
复制
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\"}"',
]
代码语言:javascript
复制
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

码头运行命令

代码语言:javascript
复制
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\"}"
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-12-16 10:57:15

我能够通过在命令中作为env传递所需的值来解决这个问题。

代码语言:javascript
复制
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}",
      ]   

而不是传递那些环境变量

代码语言:javascript
复制
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\"}" 
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65304778

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档