It’s been a hot minute since I’ve worked on the Windows Hosts Writer (WHW) and based on some feedback, a few changes were made:

  1. Now, WHW will listen to ANY network by default. No more having to remember to set it to nat or docker_default. You can still specify an override through the environment variable as before.
  2. Ability to map IPs from a single container to multiples. For example, if you’re using Traefik for SSL, and you want to have your CM and CD instances go through that, instead of direct to the container, you can totally do that! Per Bering has a good example of how to do this in docker-compose: . This makes things easier, though.
  3. Added Support for Windows 2004. Yeah, we’re that trendy here at Rock, Paper, Sitecore.

What’s this look like as part of a docker-compose file? Glad you asked!

  image: rahnemann/windows-hosts-writer:2.0-nanoserver-1809
    - C:\windows\system32\drivers\etc:C:\driversetc
    - type: npipe
      source: '\\.\pipe\docker_engine'
      target: '\\.\pipe\docker_engine'
      TERMINATION_MAP: id,cm,cd:traefik

The above example, for Windows 1809, will listen to ALL networks, and any requests to id, cm, cd services will map to the traefik endpoint. Your hosts file would look like this:	e09c1b17b317 traefik		#e09c1b17b317b89c0283678b27022b474e915f9b82896d066b532e26c5a597bb by whw	ccbbf93eca6d rendering		#ccbbf93eca6dc7cf9ff73b984a376bfe312f14886e8e12db6885c9e7732dd533 by whw	faa3cac5385d cd		#faa3cac5385d89f2fb437eed9e612e6b94f6504e1a1e2c53138d5ab24ed58987 by whw	1749cd323f73 cm		#1749cd323f7376203f501ed2be00a814485f6a59d45fc161f31c10b07dd4e5d5 by whw	64943e3887a7 id		#64943e3887a7cc2cc569a5444ad740be519a45cc589a61369842c41e00eaf758 by whw	c49f190a65cb redis		#c49f190a65cb2f31358c6926323dd4b7330f2a560f78f5d6d54bfd217de14299 by whw	c0b4c7e27b81 mssql		#c0b4c7e27b816a3137ccbc2fe6c2432d45cb3de9185b9b403eb8ecf04fd5864e by whw	e38827c7a858 solr		#e38827c7a858ea090ebe5e59df5ea618c69ea4a6d99784c639f7f4ec7994d757 by whw

Notice how the CD, CM, and ID hosts entries share the same IP as Traefik.

You can snag the latest version on Docker Hub here: or view the GitHub page:

Happy Dockering!

Edit: Version 2.0 has been released. Read more about it here!