Localhost connection refused in Docker development environment Localhost connection refused in Docker development environment curl curl

Localhost connection refused in Docker development environment


Months later, I come back to post the (quite straightforward) answer to my question:

  • Remove the server_name entry in the Nginx host configuration
  • Remove the extra_hosts entry in docker-compose.yml file (not necessary, but it's useless)

Simply call the server with the Nginx container name as a host (nginx here):

 docker-compose exec php curl http://nginx