<div dir="ltr">Hello,<div>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.<br></div><div><ol><li style="margin-left:15px"><p>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.</p></li><li style="margin-left:15px"><p>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?</p></li><li style="margin-left:15px"><p>I actually use Ansible to start containers, so the solution needs to be applicable using Ansible?</p></li></ol><div>Thank you!</div></div><div>Link to this question: <a href="https://stackoverflow.com/q/56356422/1876484" target="_blank">https://stackoverflow.com/q/56356422/1876484</a></div></div>