Cannot access localhost in another container

I have two tomcats with belonging .war deployed in containers. One app (in the first tomcat) is addressing services from the second app (and thus container) via localhost:port/service/... call.

One run cmd:

$ sudo docker run -it --rm --name portal --dns company.dns.server.ip --link middleware -p 8180:8180  portal

Middleware has access to db and internet BUT portal is not accessing services from middleware! So, how to solve this whithout changing .war files?

It seems like it is a connection prob in the level of tomcat / java: HTTP 404 Not Found