Docker for windows development environment setup

I am trying to figure out how to setup a development environment for developing multiple apis locally.

My development environment is as follows:

  • Building a compiled application with Docker
  • OpenCV error when Docker container is run on GKE
  • Proper way of reporting performance data for C# application in a Container (Docker)
  • .NET Core Container Built with VSTS won't run on Linux
  • How can I create a stream for DockerDotNet BuildImageFromDockerfile method?
  • Rebuild Docker container on file changes
  • Host Machine:
    SQL Server 2016 Express Installed on the host listening at,1433 which I can connect to locally from the host and from other PCs on the network.

    Docker for windows stable version, installed and developing netcore webapis which get containerized and run locally which I want to connect to the SQL Server Instance on the host.

    Ideally each container would have a static IP in some NAT network, however I have been unable to get static IPs working for the default NAT network setup with docker for windows.

    I have tried setting up a transparent network, however this probably won’t work as I don’t really want these on network. I would like them only to be accessible by the host, or through some port mapping by the host IP through the docker run -p command.

    I have the containers running and working (except for static ip addresses) however I cannot access the host. I can ping (what I am assuming is) the host at the gateway IP address found in the container, but I can’t seem to access any services running on the host.

    From within the container I can ping other PCs in the network (IE and have internet access, but for some reason I cannot ping the host at I get the Request timed out.

    So the question I am asking is, how can i setup a NAT network with internet access where containers can talk to the host and other containers and the host can talk to all containers too. And ideally I could setup static IPs for each service where I could setup nginx or some other reverse proxy on the host to help proxy requests to each container.

    I have tried creating a separate NAT using docker network create -d NAT mynat but it tells me the object already exists.

    I have tried accessing the host’s SQL instance by the ip address and the address defined on the virtual NIC however none of them will connect to the SQL instance or any website/api I have running on the host. The containers however can access other PC’s websites/apis on the network. Just not the host.

    So I guess I am asking if it is even possible to access the host’s services from inside a container too?

    A lot of the documentation I have found is based on linux and I’m not sure if it can be used the same or not

    Any direction anyone can give will be greatly appreciated.


    After playing all night with the docker networks, I was able to replace the default docker NAT network with my own so I could specify static IP address.

    What I did for that was add "bridge: "none" to the daemon.json file located at C:\ProgramData\Docker\config. Which made it so the default NAT network isn’t created by default

    Then I ran the following commands in an admin powershell to create my own NAT network

    PS C:\WINDOWS\system32> stop-service com.docker.service
    PS C:\WINDOWS\system32> stop-service hns
    PS C:\WINDOWS\system32> del 'C:\ProgramData\Microsoft\Windows\HNS\'
    PS C:\WINDOWS\system32> Get-ContainerNetwork | Remove-ContainerNetwork
    PS C:\WINDOWS\system32> Get-NetNat | Remove-NetNat
    PS C:\WINDOWS\system32> start-service hns
    PS C:\WINDOWS\system32> start-service com.docker.service
    PS C:\WINDOWS\system32> docker network create -d nat --subnet= --gateway= mynat

    I am then able to start my containers with the following command

    docker run -itd --net=mynat --ip= --rm <containername>

    However: I am still unable to access the SQL Server Express instance on the host machine. I thought I would be able to access it at,1433\SQL2016 or\SQL2016 however I get the error: provider: SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified for both.

    Pinging does return results, however pinging returns Request timed out.

    I have set a static IP of on the virtual NIC adapter and that didn’t seem to help anything. Hopefully someone knows how to access the host from within a container. Thanks!


    I am able to hit an api running on the host now. To be honest I am not sure what changed. But i can now hit a service at running on the host from the within the container.

    NOTE: That the port binding doesn’t seem to work though going to the static IP setup on the container. You can only hit the service on the EXPOSE port in the dockerfile and running the docker command with -p 5600:9606 doesn’t expose on 5600 it is still exposed only on 9606. calling works but localhost:5600 does not

    However I am still unable to connect to the SQL Server Express instance on the IP. I have tried adding the ip to the SQL Server bindings but that doesn’t seem to work.

    SQL Server TCP IP Settings

    I can connect from the host at,1433\SQL2016 but cannot connect at,1433\SQL2016 so I am assuming that is the issue at hand here. Windows Firewall is disabled.

    I have set the virtual NAT NIC to use the static ip also but still cannot connect to the SQL Server instance at,1433\SQL2016

    network setup

  • Figure out IP address within docker container
  • Symfony 3 and Docker (nginx, php7.1-fpm mysql8) Performances low on Windows
  • specify ip address for docker for mac
  • Deploying Django with Docker on Amazon Elastic Beanstalk
  • Pulling docker image python:2.7-onbuild taking a long time
  • Host Volumes Not getting mounted on 'Docker-compose up'
  • One Solution collect form web for “Docker for windows development environment setup”

    The last thing i had to do was enable both ipv4 and ipv6 (as ipv6 was used for some of the authentication checks I guess) on the host server for sql server express 2016. And added firewall rules.

    Hopefully this will help someone else get setup for local development and single server docker deployments.

    enter image description here

    The one thing I still cannot do is the host:container port mapping

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.