2

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
amitaibu
  • 1,026
  • 1
  • 7
  • 23
  • 3
    You'll probably want to look at https://stackoverflow.com/questions/51710272/communication-between-two-ddev-projects/53436970#53436970 - The reason you can't do that is that the name `bar.ddev.local` can't be resolved inside the container (it's added to the *host* /etc/hosts file. However, you could `curl ddev-bar-web` (the name of the web container for the "bar" project). That would likely do what you want. There are other ways you might pull it off. Maybe you can say more about what you're trying to accomplish. – rfay Mar 18 '19 at 21:50
  • 1
    Perfect, that did the trick. Now both sites can talk with each other via RESTful endpoints – amitaibu Mar 19 '19 at 09:59

1 Answers1

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
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
DarkoDev
  • 29
  • 2