I have a Webapp running completely locally on my MacBook.
The Webapp has a Front End (Angular/Javascript) and a Back End (Python/Django) which implements a RESTful A
I think the most elegant solution would be to create a software defined network, but for this simple example it may be a bit overkill. Nevertheless when you think about running things in production, maybe even on different servers, this is the way to go.
Until then, you may opt to link the containers. E.g., when you used to start your frontend container like this:
$ docker run -p 8080:8080 --name frontend my-frontend
You now could do it like this:
$ docker run -p 8080:8080 --name frontend --link backend:backend my-frontend
The trick here is to also start the backend container and giving it a name using the --name flag. Then, you can refer to this name in the --link flag and access the backend from within the frontend container using its name (--link takes care of automatically adding the linked container to the /etc/hosts file).
This way you do not have to rely on a specific IP address, be it the host's one or whatever.
Hope this helps :-)