【问题标题】:How to communicate between Azure Devops Service containers?Azure Devops Service 容器之间如何通信?
【发布时间】:2020-02-06 12:10:19
【问题描述】:

是否可以在 Azure Devops 中使用两个相互通信的 service containers。 以下对我不起作用:

resources:
  containers:
  - container: sql
    image: mcr.microsoft.com/mssql/server
    ports:
    - 8080:80
    env:
        SA_PASSWORD: "*****"
        ACCEPT_EULA: "Y"
  - container: api
    image: my-api:latest
    ports:
    - 8080:80
    env:
      connectionString: "Server=tcp:sql,1433;Initial Catalog=my-db;Persist Security Info=False;User ID=sa;Password=*****;MultipleActiveResultSets=False;Connection Timeout=30;"
services:
  sql: sql
  api: api
pool:
  vmImage: 'ubuntu-16.04'
steps:
- script: |
    ping localhost -c 10
    curl localhost:8080

当我运行它时,我收到以下错误:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to localhost port 80: Connection refused
##[error]Bash exited with code '7'.

api无法连接sql服务。当我使用 Azure sql db 的连接字符串时,它工作正常。 我在连接字符串中尝试了服务容器名称(sql,1433)和(localhost,1433)。

【问题讨论】:

    标签: azure service azure-devops containers azure-pipelines


    【解决方案1】:

    【讨论】:

    • 实际的解决方案是什么?我已经尝试了链接上发布的示例的几乎所有迭代,但我仍然遇到问题
    猜你喜欢
    • 1970-01-01
    • 2017-10-30
    • 2019-04-20
    • 2020-12-29
    • 2014-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多