'Have two ddev containers curl to each other

I have both http://foo.ddev.local and http://bar.ddev.local (two different projects)

I can use curl to call them on my host. Now I'd like foo to contact bar, however if I

ddev ssh
http://bar.ddev.local
curl: (6) Could not resolve host: http://bar.ddev.local


Solution 1:[1]

An example of extra_hosts for anyone else encountering this issue. I needed to use an HTTPS URL in a Drupal module's UI, entity_share, to cURL another ddev site (ie. couldn't use ddev-bar-web).

On foo I add a .ddev/docker-compose.hosts.yaml

version: '3.6'
services:
  web:
    extra_hosts:
      - bar.ddev.site:172.18.0.6

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeremy Caney