Running WSL (Ubuntu 20.04 LTS), I added this to my .bashrc file.
export DOCKER_GATEWAY_HOST="`/sbin/ip route|awk '/dev eth0 proto kernel/ { print $9}'`"
This runs /sbin/ip route, searches for the line containing "dev eth0 proto kernel", then grabs the 9th element from that line which corresponds to the IP address.
Running WSL (Ubuntu 20.04 LTS), I added this to my .bashrc file.
This runs
/sbin/ip route
, searches for the line containing "dev eth0 proto kernel", then grabs the 9th element from that line which corresponds to the IP address.Then, in docker-compose.yml I referenced it here,