【发布时间】: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