I want to run a docker container, and somehow intercept/modify HTTP responses in the host. That means, basically take every HTTP response coming out of the container, and modify it before sending it back to the user. Is there a standard way to do this in docker?
The Docker Registry HTTP API is the protocol to facilitate distribution of images to the docker engine. It interacts with instances of the docker registry, which is a service to manage information about docker images and enable their distribution.
local:5000): $ docker image pull myregistry. local:5000/testing/test-image Registry credentials are managed by docker-login(1). Docker uses the https:// protocol to communicate with a registry, unless the registry is allowed to be accessed over an insecure connection.
The Docker Engine API is a RESTful API accessed by an HTTP client such as wget or curl , or the HTTP library which is part of most modern programming languages.
A manifest list is a list of image layers that is created by specifying one or more (ideally more than one) image names. It can then be used in the same way as an image name in docker pull and docker run commands, for example.
What you could do is create a reverse proxy.
All communication in and out of the docker container is done indirectly, trough the proxy. So clients connect to the reverse proxy, the proxy requests the information from the process inside the container. The proxy will also handle the response to the client.
If you simply want to change some headers, a default setup of an apache reverse proxy might be enough. See this link on how to set up a reverse proxy using apache:
https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension
Other proxy technologies you might consider: - Nginx - HAProxy
If you want to do more than just changing headers (please fill me in!) than you might have to write some code to handle that for you.
Good luck! And let me know if you need more help!
Something like mitmproxy. Docker does not change the approach.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With