Host.docker.internal missing in Linux (Ubuntu)

I’m trying to resolve an issue redirecting curl from a Docker container to the host and seeing a lot of references to host.docker.internal and host-gateway which appear to have no effect and are not in my /etc/hosts file in Ubuntu where other people indicate.

Is this correct? I’m not clear whether these addresses exist for Linux as it looks like they didn’t originally but should now and if they are supported on Linux is there a way to verify they are working?

OS Version
Ubuntu (WSL2 on Windows)

Client and Server Docker Engine

Steps to Reproduce

  1. In Ubuntu terminal enter: cat /etc/hosts

  2. Observe the output:

# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateHosts = false       localhost       AM5.    AM5       mysite.localhost       phpmyadmin.localhost

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

is a feature of Docker Desktop. On Linux (servers) this is usually not installed. From within the container you can not access your hosts localhost (

See similar discussion.

That answers that question then, thanks. That link has a lot of further information, I’ll see if I can get anywhere after reading it in more detail.