dinghy-http-proxy icon indicating copy to clipboard operation
dinghy-http-proxy copied to clipboard

Resolving address in container via dinghy

Open hirnschmalz opened this issue 3 years ago • 1 comments
trafficstars

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?

hirnschmalz avatar Nov 05 '22 15:11 hirnschmalz

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

phallstrom avatar Jul 14 '25 22:07 phallstrom