title: How to communicate between Azure Devops Service containers?
body: <p>Is it possible to use two <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/process/service-containers?view=azure-devops&amp;tabs=yaml" rel="nofollow noreferrer">service containers</a> that communicate with each other in Azure Devops.
  The following didn't work for me:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>When I run this, I get the following error:</p>
  
  <pre><code>  % 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'.
  
  </code></pre>
  
  <p>The api is not able to connect the sql service. When I use a connectionstring to an Azure sql db, it works fine.
  I tried both the service container name (sql,1433) and (localhost,1433) in the connectionstring.</p>