I've been working to get SQL Server 2014 Express running in Windows Server 2016 TP5 via Windows Containers.
After following the guidelines here I'm able to start a container with Sql Server Express and attach a database.
My full docker run
command:
docker run -p 1433:1433 -v C:/temp/:C:/temp/ --env sa_password=xxxx --env attach_dbs="[{'dbName': 'Docker', 'dbFiles': ['C:\\temp\\Docker.mdf', 'C:\\temp\\Docker_log.ldf']}]" microsoft/msslq-server-2014-express-windows
However, I cannot figure out what piece I'm missing when attempting to connect SSMS on the host VM (Server 2016) to the container's SQL Server Express instance.
I'm using the default port (1433) for SQL Server in my docker run
command.
Docker version on host VM is: 1.12.1, build 23cf638
Window Server 2016 TP5 build is: 14300.rs1_release_sv.160907-0755
Running netstat -a
confirms that 1433 is being listened on in the container, but 1433 is not being listened on the host VM.
Running docker ps
while the container is running confirms that port 1433 is mapped as 0.0.0.0:1433->1433/tcp
To connect to the SQL Server instance in the container via SSMS on the host VM I'm using the sa
user and set password with the internal IP address of the container that I retrieved with the following powershell:
docker inspect --format "{{ .NetworkSettings.Networks.nat.IPAddress }}" <containerid>
Unfortunately, SSMS is unable to find the instance and I'm not sure what I'm doing incorrectly.
It turns out I needed to specify the port as well as IP when connecting from the host VM. I didn't think I needed to do that since I'm using the default sql server port.
Got the container IP from this command:
docker inspect --format "{{ .NetworkSettings.Networks.nat.IPAddress }}" <containerid>
Server name: "ip","port"\"instancename" worked and was able get in with both sqlcmd and SSMS on the host VM.