Docker Community Forums

Share and learn in the Docker community.

Is there a way to proxy a dockerized application without making changes in its code?


I have the following scenario. I have an application which is dockerized. I have modified my ~/.docker/config.json so that my docker container is proxied by http://localhost:8080. I have also a proxy which listens to that port 8080. The thing I’ve been struggling with is that when I use the command

     docker exec -it <name-of-my-container> sh

and I enter into my container and make a curl to some HTTP address, my proxy intercepts that HTTP request and everything is fine. But when my application which is running inside that exact container (it is running on containerPort: 8070) makes does the same, the request is not intercepted. I know that if I made my application use proxy, everything would work. But the main question is, can I somehow have HTTP requests coming out from my dockerized application intercepted without making any changes in its code but only altering in docker network & the solution will work on Kubernetes? I have those docker images on GitLab, if someone would want to have a look at the details I can publish them.