So, that makes it kinda easy to get your current IP address for the docker exec command above.
#Docker ip address not working windows#
Some irony here: You can locally lookup your local host's IP address by a DNS lookup of, because Docker for Windows maintains that DNS name in your local C:\Windows\System32\drivers\etc\hosts file. I've resorted to creating a script that essentially looks up the container which needs to resolve my local host by name, and invokes:ĭocker exec /bin/sh -c "echo '\t' > /etc/hosts" (I'm using a JWT whose issuer is set to my local machine's FQDNS, and this JWT is used both locally and in the docker container.) I also don't have the option of using the magical DNS name, because I need a DNS name that resolves both inside the docker container, and in locally running scripts. The solution of adding an extra_hosts entry cannot be applied to all of my use-cases (in some cases, the compose file is not mine to manipulate). In fact, resolution of the magical DNS name fails if I configure the docker daemon dns in this fashion. As others have experienced, this doesn't seem to help.
#Docker ip address not working how to#
I tried configuring the docker daemon dns setting to be my domain DNS server, which knows how to resolve my local host's fully qualified DNS name. Reset to factory defaults (as described here: ) also did not help. I've had the same experience with Docker Desktop for Windows versions 2.1.0.1 and 2.1.0.3. Check that busybox not have the same DNS ip address that is setted in DNS configuration in Dockerīut, if I set -dns option with docker run command, the result is the same,Īlso, if I change the daemon configuration in Docker, same result, see the following images:
![docker ip address not working docker ip address not working](https://i.stack.imgur.com/xuC9L.png)
Apply fixed DNS configuration and restart Docker.If I set the DNS configuration fixed in Docker, the result is the same. The ip address that appears as nameserver in /etc/nf is assigned automatic by Docker according to Network settings. Get valid ping or nslookup response using busybox docker image Actual behavior Windows Version: Windows build 17763.379.Create a docker config file if one doesnt exist in /etc.
![docker ip address not working docker ip address not working](https://i.stack.imgur.com/KCXbA.png)
![docker ip address not working docker ip address not working](https://miro.medium.com/max/881/1*Be3SFGBG__G3SzOReG3k5Q.png)
How do I change my docker host IP address How-To: Change the Docker IP address space. Each network also has a default subnet mask and gateway.