dinghy-http-proxy
dinghy-http-proxy copied to clipboard
Resolving address in container via dinghy
I have a http container running on port 80. dinghy is used to make container available via https://my.domain.tld.docker on my development machine. So far so good.
No I should run a job inside the container. The job should fetch some data from the current container and get's the URL via configuration. The configuration tells the job, that the URL is https://my.domain.tld.docker. The problem now is, that the app itself runs on port 80 only. So what I would need is a hosts entry which points to the dinghy IP.
Is this possible? Any ideas?
You can cheat by adding the host/ip to /etc/hosts. This does mean traffic will route through your host, but it does work. I have something like this in my entrypoint.
if ! grep -q my.domain.tld.docker /etc/hosts;
then
host_ip=$(
nslookup host.docker.internal |\
grep Address |\
tail -1 |\
sed 's/.*: //'
)
echo "$host_ip my.domain.tld.docker" >> /etc/hosts
fi