I have 3 docker services - 1) Vue JS frontend 2) Python Rest API and 3) Mysqldb. I am trying to make a call to the Rest API from the Vue container, using axios. I am getting Connnection Refused error. I have tried changing the API URLs like - https://0.0.0.0:1111https://localhost:1111, public-domain-name:1111, public-IP:1111 etc but no luck. The host and container are mapped like this in the compose file … 1111:1111 I have ensured that Vue and Python API are in the same network and so is Python API and DB.
I have seen many other posts in this regard here, but they are of a different problem than mine. So any pointers would be much appreciated.
First pointer would be to search for a tutorial about networking in Docker context
And share your docker-compose.yml so we can better understand your configuration.
Most containers by itself don’t provide TLS/SSL capabilities, but you try to connect with https.
If you want to expose multiple services/containers on the same IP:port, you can place a reverse proxy in front, which usually also manages TLS/SSL. See nginx-proxy or simple Traefik example.
Some firewalls block requests that are sent from a container to the host IP address (or domain, which is the same) and the rest of the solutions you tried don’t really make sense. Using 0.0.0.0 might work in a browser, but that is not an actual IP address just a way to define that an app should listen on every available IP addresses and you want to access an IP not an app to listen on an IP. And localhost won’t work inside a container unless that container uses host network mode.
So as @bluepuma77 wrote, you should learn about the Docker way of accessing a container from another using the container name or compose service name as domain name in a user defined docker bridge.