willnorris/imageproxy
is a caching image proxy server that we use in one of our deployments. We typically have a PHP backend that will serve some html or json to a client where the URL would be http://<imageproxy>/200/https://willnorris.com/logo.jpg
. Then the client will fetch that image from the proxy. This is fine.
What I cannot get working is doing this in local development using Docker (Compose). The problem is that, unlike production, the domain I want to fetch images from is running on the host, typically only exposed on the loopback interface (127.0.0.*). I typically define an entry in my /etc/hosts
folder that is something like
127.0.0.2 web.myproj admin.myproj cdn.myproj
And then I access web.myproj
on that computer. How would I get the Docker container to connect to the localhost address of its host (whatever this is called in Docker lingo)? I suppose I can use the extra_hosts
feature somehow?
If specifically connecting to a reserved loopback address/localhost is not possible/permitted, is there another way to access an ip of the host?
Tech details
- Host: Ubuntu 21.04 running inside a VMWare Workstation on Windows 10 Pro
0 Answers