I started using Docker a short time ago, probably because of this I got stuck in this problem.
I have an API and Front that is making requests via cURL for it.
But when I put these projects in Docker and separated them in containers (to "simulate" the actual situation, since the API strong> stand on separate servers) the cURL requisitions have stopped working.
I did other tests and could not make cURL work between containers . Here's an example image:
Docker Image used to create the two containers.
In the above test we used the following Docker-compose (as exemplified in the next image the only difference between the two containers and the docker-compose is the port and container names):
a:
environment:
TZ: "America/Sao_Paulo"
image: o2multi/apache-php7
ports:
- "80:80"
volumes:
- ./src:/var/www/html/
IfItrytomakecURLforotherplacesitworksperfectly.
Attemptsmade----------------
version:'2'services:a:environment:TZ:"America/Sao_Paulo"
image: o2multi/apache-php7
ports:
- "80:80"
volumes:
- ./a:/var/www/html/
links:
- b
b:
environment:
TZ: "America/Sao_Paulo"
image: o2multi/apache-php7
ports:
- "443:80"
volumes:
- ./b:/var/www/html/