Thursday, October 11, 2018

Getting SQL Server 2017 Running with Docker

My laptop at work was recently upgraded to Windows 10 Enterprise. One of the exciting things for me about the Windows 10 roll-out is that now I am able to use Docker to launch container images without having to install/uninstall software. If you don't know about containers or what docker is you can learn about them using these links:


To get SQL Server 2017 developer installed and running follow these steps

  1. Download and install Docker. I had to disable McAfee to get in installed.

  2. Make sure Docker is working by using the docker pull command to get the hello-world container








  3. Test the container using the docker run command. You should see output similar to below
















  4. Next pull the latest copy of the SQL 2017 Developer container using the docker pull command. This can take quite some time to download.

    docker pull microsoft/mssql-server-windows-developer

  5. Then you can launch the container using the docker run command
  6. NOTE: Change the value for sa_password to what you want it to be. Make sure it fits within the password guidlines of SQL or you will not be able to log in

    docker run -d -p 1433:1433 -e sa_password='Password123' -e ACCEPT_EULA=Y microsoft/mssql-server-windows

  7. Next we want to connect to the container from SSMS so we need the IP address. Run the below command to view the running conatiners

    docker ps

  8. You should get a result like this



  9. You can use the container ID from above to get the IP address of your container using the docker inspect
  10. NOTE: Replace 7fee03f6f3a0 in the script below with your conatainer ID

    docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' 7fee03f6f3a0







  11. Now you can use the IP address in SSMS to connect to the SQL server running in your container. Use SQL Server Authentication with sa for the login and the password you chose in step 5

















  12. When you are done you can stop the container using the docker stop command
  13. NOTE: Change the container ID to your ID

    docker stop 7fee03f6f3a0

    Then if you run docker ps again, it should be blank






  14. Finally you can remove the container using docker rm
    NOTE: Change the container ID to your ID

    docker rm 7fee03f6f3a0


No comments:

Post a Comment