{"id":16895,"date":"2016-10-13T10:00:08","date_gmt":"2016-10-13T17:00:08","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/dataplatforminsider\/?p=16895"},"modified":"2024-01-22T22:50:35","modified_gmt":"2024-01-23T06:50:35","slug":"sql-server-2016-express-edition-in-windows-containers","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2016\/10\/13\/sql-server-2016-express-edition-in-windows-containers\/","title":{"rendered":"SQL Server 2016 Express Edition in Windows containers"},"content":{"rendered":"
We are excited to announce the public availability of SQL Server 2016 Express Edition in Windows Containers! The image is now available on Docker Hub and the build scripts are hosted on our SQL Server Samples GitHub repository. This image can be used in both Windows Server Containers as well as Hyper-V Containers.<\/p>\n
SQL Server 2016 Express Edition Docker Image<\/a><\/p>\n We hope you will find these images useful and leverage them for your container-based applications!<\/p>\n SQL Server 2016 in a Windows container would be ideal when you want to:<\/p>\n Before you can get started with the SQL Server 2016 Express Edition image, you\u2019ll need a Windows Server 2016 or Windows 10 host with the latest updates, the Windows Container feature enabled, and the Docker engine.<\/p>\n Please find the details for each of these requirements below.<\/p>\n Below are the Docker pull and run commands for running SQL Server 2016 Express instance in a Windows Container.<\/p>\n Make sure that the mandatory sa_password<\/b> environment variable meets the SQL Server 2016 Password Complexity requirements<\/a>.<\/p>\n First, pull the image<\/b><\/p>\n docker pull microsoft\/mssql-server-2016-express-windows<\/span><\/p>\n Then, run a SQL Server container<\/b><\/p>\n Running a Windows Server Container (Windows Server 2016 only):<\/p>\n docker run -d -p 1433:1433 \u2013\u2013env sa_password=<YOUR_PWD> microsoft\/mssql-server-2016-express-windows<\/span><\/p>\n Running a Hyper-V Container (Windows Server 2016 or Windows 10):<\/p>\n docker run -d -p 1433:1433 \u2013\u2013env sa_password=<YOUR_PWD> \u2013\u2013isolation=hyperv<\/b> microsoft\/mssql-server-2016-express-windows<\/span><\/p>\n An easy way to connect to the SQL Server instance from inside<\/i> the container is by using the sqlcmd utility<\/a>.<\/p>\n First, use the docker ps<\/b> command to get the container ID that you want to connect to and use it to replace the parameter placeholder \u2018<DOCKER_CONTAINER_ID>\u2019 in the commands below. You can use the docker exec -it<\/b> command to create an interactive command prompt that will execute commands inside of the container.<\/p>\n You can connect to SQL Server by using either Windows or SQL Authentication.<\/p>\n Windows authentication using container administrator account<\/b><\/p>\n docker exec -it <DOCKER_CONTAINER_ID> sqlcmd<\/span><\/p>\n SQL authentication using the system administrator (SA) account<\/b><\/p>\n docker exec -it <DOCKER_CONTAINER_ID> sqlcmd -S. -Usa<\/span><\/p>\n One of the ways to access SQL Server 2016 from outside the container is by installing SQL Server Management Studio (SSMS)<\/a>. You can install and use SSMS either on the host or on another machine that can remotely connect to the host .<\/p>\n Connect from SSMS installed on the host <\/b><\/p>\n To connect from SSMS installed on the host, you\u2019ll need the following information:<\/p>\n Connect from SSMS on another machine (other than the Host Environment) <\/b><\/p>\n To connect from SSMS installed on another machine (that can connect to the host), you\u2019ll need the following information:<\/p>\n Please refer to this<\/a> link for all SQL Server 2016 features that are supported on a Windows Server Core installation.<\/p>\n Check out this blog post by Alex Ellis, Docker Captain, on how to use SQL Server 2016 Express Edition in a Windows container as part of an application development and test environment on Windows 10.<\/p>\n Docker with Microsoft SQL 2016 + ASP.NET<\/a><\/p>\n Windows Containers Documentation<\/a> We are excited to announce the public availability of SQL Server 2016 Express Edition in Windows Containers! The image is now available on Docker Hub and the build scripts are hosted on our SQL Server Samples GitHub repository. This image can be used in both Windows Server Containers as well as Hyper-V Containers. SQL Server<\/p>\n","protected":false},"author":1457,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ep_exclude_from_search":false,"_classifai_error":"","footnotes":""},"post_tag":[],"product":[5227,2403],"content-type":[2424,2448],"topic":[2466],"coauthors":[2487],"class_list":["post-16895","post","type-post","status-publish","format-standard","hentry","product-sql","product-sql-server-2016","content-type-best-practices","content-type-updates","topic-developer","review-flag-1593580419-556","review-flag-1593580427-503","review-flag-lever-1593580264-545"],"yoast_head":"\nWhy use SQL Server in containers?<\/h2>\n
\n
Prerequisites<\/h2>\n
\n
\n
\n
Pulling and Running SQL Server 2016 in a Windows Container<\/h2>\n
Connecting to SQL Server 2016<\/h2>\n
From within the container<\/h4>\n
From outside the container<\/h4>\n
\n
\nOne of the ways to get the IP address of the container is by using the docker inspect<\/b><\/a> command:
\ndocker inspect –format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}’ <DOCKER_CONTAINER_ID><\/span><\/li>\n
\nThis is the same port number that was specified in the docker run<\/b> command. If you used 1433 you don\u2019t need to specify the port. If you want to specify a port to connect to you can add it to the end of the server name like this: myserver,1433.<\/li>\n
\nThe username is \u2018sa\u2019 and the sa_password<\/b> that was used in the docker run command.<\/li>\n<\/ul>\n\n
\nYou can get the host\u2019s IP address by using the ipconfig<\/b> command from a PowerShell or command prompt window.<\/li>\n
\nThis is the same port that was specified in the docker run<\/b> command. If you used 1433 you don\u2019t need to specify the port. If you want to specify a port to connect to you can add it to the end of the server name like this: myserver,1433.
\nNote: Depending on your configuration, you might have to create a firewall rule<\/a> to open the necessary SQL Server ports on the host. Please refer to this<\/a> article for more information regarding container networking.<\/li>\n
\nThe username is \u2018sa\u2019 and the sa_password<\/b> that was used in the docker run command.<\/li>\n<\/ul>\nSQL 2016 Features Supported on Windows Server Core<\/h2>\n
Developing Using Windows 10 Containers<\/h2>\n
Further Reading<\/h2>\n
\nContainer Resource Management<\/a>
\nTutorials for SQL Server 2016<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"