Comment puis-je configurer DNS pour que mon conteneur php-fpm sache envoyer certains hôtes au conteneur nginx avec docker-compose?

I have two containers:



I have these two that work great.

I have a REST API that I am developing, it is a different project.

I need my web application to be able to send API calls to this

However, php-fpm doesn't know how to fix it.

Should I set up a DNS server container and make php-fpm use the DNS server?

And does the DNS server route specific hosts to nginx and then it all rolls back to Google

TweakboxDoes anyone have an example of how to achieve this with docker-compose?
Dernière édition:


New Member
Hello, @bearsethi96 Spotify Receiptify

To enable your php71-fpm container to resolve without setting up a DNS server, follow these steps:

Create a Docker network to allow containers to communicate with each other.

Define your services (nginx, php71-fpm, and the API) in the Docker Compose file and ensure they are on the same network.

Configure Nginx to route the requests to your API.

Example Explanation:
Create a Docker Network: Define a network in your Docker Compose file to allow your containers to communicate.

Set Up Services
nginx: This will handle incoming requests.

php71-fpm: Your PHP application server.

API: Your REST API service.

Configure Nginx:
Configure Nginx to route requests for to the API container.

Docker Compose Configuration:
Define a network named mynetwork in your Docker Compose file.

Ensure all services (nginx, php71-fpm, API) are attached to this network.

I hope this will help you out
Dernière édition: