Welcome! Log In Create A New Profile

Advanced

nginx inside docker: mapping localhost:port in one container to another_container:port

Sim Tov
May 29, 2019 07:56AM
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
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx inside docker: mapping localhost:port in one container to another_container:port

Sim Tov May 29, 2019 07:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 265
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready