We are working on setting up Sitecore 10 in containers in Docker. I have been able to set up a simple XP0 configuration which works when I run docker-compose up -d
on a Windows Server 2019 machine.
The issue occurs, however, when I run it on a Windows 10 machine: the containers cannot access each other or themselves by name. When I run docker-compose up -d
on the Windows 10 machine, it creates each of the containers successfully, but the several containers are unhealthy because the mssql container was not able to create the shard databases for xDB. It can't create those databases because the script that makes the call to create them uses the container's service name ("mssql") in the database connection string and the container is unable to resolve its own service name.
It turns out, after significant investigation, that Docker's DNS server seems to be failing to respond to requests from inside the container. When I run the below commands from inside the container, this is the result:
PS C:\> ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : 0b4ae6f46a90
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : custom-domain.com
Connection-specific DNS Suffix . : custom-domain.com
Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Container Adapter
Physical Address. . . . . . . . . : 00-15-5D-74-CA-B8
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::e566:a72a:ab7c:6108%27(Preferred)
IPv4 Address. . . . . . . . . . . : 172.31.51.68(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . : 172.31.48.1
DNS Servers . . . . . . . . . . . : 172.31.48.1
10.1.2.3
NetBIOS over Tcpip. . . . . . . . : Disabled
Connection-specific DNS Suffix Search List :
custom-domain.com
PS C:\> ping 172.31.48.1
Pinging 172.31.48.1 with 32 bytes of data:
Reply from 172.31.48.1: bytes=32 time=1ms TTL=128
Reply from 172.31.48.1: bytes=32 time=1ms TTL=128
Reply from 172.31.48.1: bytes=32 time<1ms TTL=128
Ping statistics for 172.31.48.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
PS C:\> ping mssql
Ping request could not find host mssql. Please check the name and try again.
PS C:\> nslookup mssql
DNS request timed out.
timeout was 2 seconds.
Server: UnKnown
Address: 172.31.48.1
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
*** Request to UnKnown timed-out
Note: we're not doing anything fancy in our network configurations in Docker Compose or elsewhere; we're using all the defaults.
What I have verified:
- All installed software and features are the same between the two host machines (Docker Desktop, WSL2, Hyper-V, etc.)
- Both host machines can access the internet and are not having other connectivity issues
- Both machines are running the containers in process isolation mode
- The issue is not caused by a lack of hostnames. I've tried the solution in this answer.
Has anyone seen this before?
ISOLATION
parameter in your.env
file? Have you tried withISOLATION=hyperv
or withISOLATION=process?
?hyperv
; I currently have it set toprocess
. Unfortunately, neither resolves the issue.