Local development issues and container visibility

My local (pc) development is:

  1. Ubuntu LTS 16.04
  2. Docker version 17.12.0-ce, build c97c6d6
  3. docker-compose version 1.8.0

I’m trying to build a simple web app front end (first container) that talks with a node js back end (second container).
in docker compose file I have two services: web and nodeservice.

When I try to call from web the rest service exposed by nodeservice, I get an error if I use the url nodeservice:3000/api, instead it’s ok when I use localhost:3000/api

The first question is: if this behavior is correct, and I can understand it, how can I do when I deploy it in production (swarm, cluster, …)? That is what I write inside web app html: localhost or nodeservice?

The second question is: which suggestion to local develop such apps like that?

Thanks in advance.
Regards,
Marcello.

Your version of docker-compose is over a year old, which means a lot of things you’ll see in the documentation won’t apply. It’ll also be much easier for people here to help you if you upgrade.

It’s also a good idea to share your Compose file so we can help you identify potential issues with your configuration.

I updated docker-compose to 1.19.0, but the questions remain (see above…).

Thx,
Marcello.

Hi @mezzapelle
This is a very old post, but I will try to help anyway.
From what I understand, it is a common problem. Your FrontEnd application is static, and serves the configuration to the browser.
In which part of the FrontEnd code is the API URL configured?