nginx inside docker: mapping localhost:port in one container to another_container:port
Sim Tov
smntov at gmail.com
Wed May 29 11:53:57 UTC 2019
Hello,
I have a custom network and two containers A and B connected to it.
Container A (with Debian inside) runs nginx and an application that listens
to localhost:8083 and expects certain service there. Once deployed this
service runs in container B and not locally. For certain reasons I can't
change localhost to something else inside the application.
1.
How can I map localhost:8083 from A to name_of_container_B:8083 on the
Docker/nginx/infrastructure/OS level? name_of_container_B is not known
during creation of A image, but I can pass it as docker entrypoint
parameter during launch of conatiner A.
2.
I prefer not to add additional packages in order not to increase overall
complexity. So is it, for example, possible to configure nginx somehow to
listen on localhost:8083 and forward it to name_of_container_B:8083?
3.
I actually use Ansible to start containers, so the solution needs to be
applicable using Ansible?
Thank you!
Link to this question: https://stackoverflow.com/q/56356422/1876484
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20190529/6b8b94b9/attachment.html>
More information about the nginx
mailing list