I don't seem to be able to sent a http request from a Website to my backend using the Docker VPN.
I have this docker-compose file:
version: '3.7'
services:
frontend:
ports:
- 5001:5001
build: "./..."
restapi:
build: "./.../"
command: gunicorn rest.wsgi:application --bind 0.0.0.0:8000
expose:
- 8000
depends_on:
- db
db:
image: postgres:10.5-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
Now, from my react frontend, I am trying to sent a post request
axios.post('http://restapi:8000/rest/', {data}, {headers})
--> The request simply fails and never gets to my restapi service
If I go in my container in my container: docker exec -it "container-id" sh
and then sent a wget
(curl) request to the url, everything works fine.
I am asuming that, as soon as the website runs in the browser, I have leftthe container and therefore the VPN of docker?
But how can I make a request across containers from a react frontend?