I have a docker container that has been created using docker-compose. Here is the yml file.
version: "3"
services:
redis:
image: "redis"
web:
image: "myimage"
ports:
- "8000:8000"
environment:
REDIS_HOST: redis
volumes:
- .:/usr/src/app
depends_on:
- "redis"
command: ["npm", "start"]
From this container my web app needs to connect to the local machine because my local machine is running another web app that my docker container's web app needs to access. How do I do this? The localhost's webapp is hosted on a different port (7777).
I have already seen From inside of a Docker container, how do I connect to the localhost of the machine?, and I got it to work using "extra_hosts" option, but I want to know if there is another way to do this?