You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/linux/quickstart-install-connect-docker.md
+96-8Lines changed: 96 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
-
title: Get started with SQL Server 2017 on Docker | Microsoft Docs
3
-
description: This quickstart shows how to use Docker to run the SQL Server 2017 container image. You then create and query a database with sqlcmd.
2
+
title: Get started with SQL Server containers on Docker | Microsoft Docs
3
+
description: This quickstart shows how to use Docker to run the SQL Server 2017 and 2019 container images. You then create and query a database with sqlcmd.
4
4
author: rothja
5
5
ms.author: jroth
6
6
manager: craigg
@@ -14,11 +14,11 @@ ms.custom: "sql-linux"
14
14
ms.prod_service: linux
15
15
ms.assetid: 82737f18-f5d6-4dce-a255-688889fdde69
16
16
---
17
-
# Quickstart: Run the SQL Server 2017 container image with Docker
17
+
# Quickstart: Run SQL Server container images with Docker
In this quickstart, you use Docker to pull and run the SQL Server 2017 container image, [mssql-server-linux](https://hub.docker.com/r/microsoft/mssql-server-linux/). Then connect with **sqlcmd** to create your first database and run queries.
21
+
In this quickstart, you use Docker to pull and run the SQL Server container image, [mssql-server-linux](https://hub.docker.com/r/microsoft/mssql-server-linux/). Then connect with **sqlcmd** to create your first database and run queries.
22
22
23
23
This image consists of SQL Server running on Linux based on Ubuntu 16.04. It can be used with the Docker Engine 1.8+ on Linux or on Docker for Mac/Windows.
24
24
@@ -32,7 +32,10 @@ This image consists of SQL Server running on Linux based on Ubuntu 16.04. It can
32
32
- Minimum of 2 GB of RAM
33
33
-[System requirements for SQL Server on Linux](sql-server-linux-setup.md#system).
34
34
35
-
## Pull and run the container image
35
+
<!--The following H2 is versioned for 2017 and 2019. Much of the content is duplicated, so
36
+
any changes to one section should be considered to be mirrored in the other-->
> This quickstart uses the SQL Server 2017 Docker image. If you want to run the SQL Server 2019 CTP 2.0 image, see the [SQL Server 2019 CTP 2.0 version of this article](quickstart-install-connect-docker.md?view=sql-server-linux-ver15#pullandrun2019).
52
+
47
53
The previous command pulls the latest SQL Server 2017 container image. If you want to pull a specific image, you add a colon and the tag name (for example, `microsoft/mssql-server-linux:2017-GA`). To see all available images, see [the mssql-server-linux Docker hub page](https://hub.docker.com/r/microsoft/mssql-server-linux/tags/).
48
54
49
55
For the bash commands in this article, `sudo` is used. On MacOS, `sudo` might not be required. On Linux, if you do not want to use `sudo` to run Docker, you can configure a **docker** group and add users to that group. For more information, see [Post-installation steps for Linux](https://docs.docker.com/install/linux/linux-postinstall/).
50
56
51
-
1. To run the container image with Docker, you can use the following command from a bash shell (Linux/macOS) or elevated PowerShell command prompt.
57
+
2. To run the container image with Docker, you can use the following command from a bash shell (Linux/macOS) or elevated PowerShell command prompt.
52
58
53
59
```bash
54
60
sudo docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=<YourStrong!Passw0rd>' \
@@ -78,7 +84,87 @@ This image consists of SQL Server running on Linux based on Ubuntu 16.04. It can
78
84
|**--name sql1**| Specify a custom name for the container rather than a randomly generated one. If you run more than one container, you cannot reuse this same name. |
79
85
|**microsoft/mssql-server-linux:2017-latest**| The SQL Server 2017 Linux container image. |
80
86
81
-
1. To view your Docker containers, use the `docker ps` command.
87
+
3. To view your Docker containers, use the `docker ps` command.
88
+
89
+
```bash
90
+
sudo docker ps -a
91
+
```
92
+
93
+
```PowerShell
94
+
docker ps -a
95
+
```
96
+
97
+
You should see output similar to the following screenshot:
4. If the **STATUS** column shows a status of **Up**, then SQL Server is running in the container and listening on the port specified in the **PORTS** column. If the **STATUS** column for your SQL Server container shows **Exited**, see the [Troubleshooting section of the configuration guide](sql-server-linux-configure-docker.md#troubleshooting).
102
+
103
+
The `-h` (host name) parameter is also useful, but it is not used in this tutorial for simplicity. This changes the internal name of the container to a custom value. This is the name you'll see returned in the following Transact-SQL query:
104
+
105
+
```sql
106
+
SELECT @@SERVERNAME,
107
+
SERVERPROPERTY('ComputerNamePhysicalNetBIOS'),
108
+
SERVERPROPERTY('MachineName'),
109
+
SERVERPROPERTY('ServerName')
110
+
```
111
+
112
+
Setting `-h` and `--name` to the same value is a good way to easily identify the target container.
113
+
::: moniker-end
114
+
<!--End of 2017 "Pull and run" section-->
115
+
116
+
<!--This is the 2019 version of the "Pull and run" section-->
> This quickstart uses the SQL Server 2019 CTP 2.0 Docker image. If you want to run the SQL Server 2017 image, see the [SQL Server 2017 version of this article](quickstart-install-connect-docker.md?view=sql-server-linux-2017#pullandrun2019).
132
+
133
+
The previous command pulls the latest SQL Server 2019 CTP 2.0 container image. If you want to pull a specific image, you add a colon and the tag name (for example, `microsoft/mssql-server-linux:2019-GA`). To see all available images, see [the mssql-server-linux Docker hub page](https://hub.docker.com/r/microsoft/mssql-server-linux/tags/).
134
+
135
+
For the bash commands in this article, `sudo` is used. On MacOS, `sudo` might not be required. On Linux, if you do not want to use `sudo` to run Docker, you can configure a **docker** group and add users to that group. For more information, see [Post-installation steps for Linux](https://docs.docker.com/install/linux/linux-postinstall/).
136
+
137
+
2. To run the container image with Docker, you can use the following command from a bash shell (Linux/macOS) or elevated PowerShell command prompt.
138
+
139
+
```bash
140
+
sudo docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=<YourStrong!Passw0rd>' \
141
+
-p 1433:1433 --name sql1 \
142
+
-d microsoft/mssql-server-linux:2019-latest
143
+
```
144
+
145
+
```PowerShell
146
+
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=<YourStrong!Passw0rd>" `
147
+
-p 1433:1433 --name sql1 `
148
+
-d microsoft/mssql-server-linux:2019-latest
149
+
```
150
+
151
+
> [!NOTE]
152
+
> The password should follow the SQL Server default password policy, otherwise the container can not setup SQL server and will stop working. By default, the password must be at least 8 characters long and contain characters from three of the following four sets: Uppercase letters, Lowercase letters, Base 10 digits, and Symbols. You can examine the error log by executing the [docker logs](https://docs.docker.com/engine/reference/commandline/logs/) command.
153
+
154
+
> [!NOTE]
155
+
> By default, this creates a container with the Developer edition of SQL Server 2019 CTP 2.0. The process for running production editions in containers is slightly different. For more information, see [Run production container images](sql-server-linux-configure-docker.md#production).
156
+
157
+
The following table provides a description of the parameters in the previous `docker run` example:
158
+
159
+
| Parameter | Description |
160
+
|-----|-----|
161
+
|**-e 'ACCEPT_EULA=Y'**| Set the **ACCEPT_EULA** variable to any value to confirm your acceptance of the [End-User Licensing Agreement](http://go.microsoft.com/fwlink/?LinkId=746388). Required setting for the SQL Server image. |
162
+
|**-e 'SA_PASSWORD=\<YourStrong!Passw0rd\>'**| Specify your own strong password that is at least 8 characters and meets the [SQL Server password requirements](../relational-databases/security/password-policy.md). Required setting for the SQL Server image. |
163
+
|**-p 1433:1433**| Map a TCP port on the host environment (first value) with a TCP port in the container (second value). In this example, SQL Server is listening on TCP 1433 in the container and this is exposed to the port, 1433, on the host. |
164
+
|**--name sql1**| Specify a custom name for the container rather than a randomly generated one. If you run more than one container, you cannot reuse this same name. |
165
+
|**microsoft/mssql-server-linux:2019-latest**| The SQL Server 2019 CTP 2.0 Linux container image. |
166
+
167
+
3. To view your Docker containers, use the `docker ps` command.
82
168
83
169
```bash
84
170
sudo docker ps -a
@@ -92,7 +178,7 @@ This image consists of SQL Server running on Linux based on Ubuntu 16.04. It can
1. If the **STATUS** column shows a status of **Up**, then SQL Server is running in the container and listening on the port specified in the **PORTS** column. If the **STATUS** column for your SQL Server container shows **Exited**, see the [Troubleshooting section of the configuration guide](sql-server-linux-configure-docker.md#troubleshooting).
181
+
4. If the **STATUS** column shows a status of **Up**, then SQL Server is running in the container and listening on the port specified in the **PORTS** column. If the **STATUS** column for your SQL Server container shows **Exited**, see the [Troubleshooting section of the configuration guide](sql-server-linux-configure-docker.md#troubleshooting).
96
182
97
183
The `-h` (host name) parameter is also useful, but it is not used in this tutorial for simplicity. This changes the internal name of the container to a custom value. This is the name you'll see returned in the following Transact-SQL query:
98
184
@@ -104,6 +190,8 @@ SELECT @@SERVERNAME,
104
190
```
105
191
106
192
Setting `-h` and `--name` to the same value is a good way to easily identify the target container.
0 commit comments