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
title: Get started with SQL Server containers on Docker (running SQL Server on Linux)
2
+
title: Get started with SQL Server Linux containers on Docker
3
3
titleSuffix: SQL Server
4
4
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.
@@ -33,9 +34,11 @@ In this quickstart, you use Docker to pull and run the SQL Server 2017 container
33
34
34
35
In this quickstart, you use Docker to pull and run the SQL Server 2019 preview container image, [mssql-server](https://hub.docker.com/r/microsoft/mssql-server). Then connect with **sqlcmd** to create your first database and run queries.
35
36
37
+
> [!TIP]
38
+
> This quickstart creates SQL Server 2019 preview containers. If you prefer to create SQL Server 2017 containers, see the [SQL Server 2017 version of this article](quickstart-install-connect-docker.md?view=sql-server-linux-2017).
36
39
::: moniker-end
37
40
38
-
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. This quick start specifically focuses on using the SQL Server on **linux** image. The Windows image is not covered, but you can learn more about it on the [mssql-server-windows-developer Docker Hub page](https://hub.docker.com/r/microsoft/mssql-server-windows-developer/).
41
+
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. This quickstart specifically focuses on using the SQL Server on **linux** image. The Windows image is not covered, but you can learn more about it on the [mssql-server-windows-developer Docker Hub page](https://hub.docker.com/r/microsoft/mssql-server-windows-developer/).
39
42
40
43
## <aid="requirements"></a> Prerequisites
41
44
@@ -51,6 +54,8 @@ any changes to one section should be duplicated in the other-->
51
54
52
55
## <aid="pullandrun2017"></a> Pull and run the container image
53
56
57
+
Before starting the following steps, make sure that you have selected your preferred shell (bash, PowerShell, or cmd) at the top of this article.
58
+
54
59
1. Pull the SQL Server 2017 Linux container image from Microsoft Container Registry.
55
60
56
61
::: zone pivot="cs1-bash"
@@ -65,16 +70,23 @@ any changes to one section should be duplicated in the other-->
> If you want to try the SQL Server 2019 preview image, see the [SQL Server 2019 preview version of this article](quickstart-install-connect-docker.md?view=sql-server-linux-ver15#pullandrun2019).
70
81
71
82
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, `mcr.microsoft.com/mssql/server:2017-GA-ubuntu`). To see all available images, see [the mssql-server Docker hub page](https://hub.docker.com/r/microsoft/mssql-server).
72
83
84
+
::: zone pivot="cs1-bash"
73
85
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/).
86
+
::: zone-end
74
87
75
88
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.
76
89
77
-
78
90
::: zone pivot="cs1-bash"
79
91
```bash
80
92
sudo docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=<YourStrong!Passw0rd>' \
@@ -91,6 +103,14 @@ any changes to one section should be duplicated in the other-->
91
103
```
92
104
::: zone-end
93
105
106
+
::: zone pivot="cs1-cmd"
107
+
```cmd
108
+
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=<YourStrong!Passw0rd>" `
109
+
-p 1433:1433 --name sql1 `
110
+
-d mcr.microsoft.com/mssql/server:2017-latest
111
+
```
112
+
::: zone-end
113
+
94
114
> [!NOTE]
95
115
> 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.
96
116
@@ -122,6 +142,12 @@ any changes to one section should be duplicated in the other-->
122
142
```
123
143
::: zone-end
124
144
145
+
::: zone pivot="cs1-cmd"
146
+
```cmd
147
+
docker ps -a
148
+
```
149
+
::: zone-end
150
+
125
151
You should see output similar to the following screenshot:
> This quickstart uses the SQL Server 2019 preview 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#pullandrun2017).
166
200
167
-
The previous command pulls the latest SQL Server 2019 preview container image based on Ubuntu. To instead use container images based on RedHat, see [Run RHEL-based container images](sql-server-linux-configure-docker.md#rhel). If you want to pull a specific image, you add a colon and the tag name (for example, `mcr.microsoft.com/mssql/server:2017-GA`). To see all available images, see [the mssql-server-linux Docker hub page](https://hub.docker.com/_/microsoft-mssql-server).
201
+
The previous command pulls the SQL Server 2019 preview container image based on Ubuntu. To instead use container images based on RedHat, see [Run RHEL-based container images](sql-server-linux-configure-docker.md#rhel). To see all available images, see [the mssql-server-linux Docker hub page](https://hub.docker.com/_/microsoft-mssql-server).
168
202
203
+
::: zone pivot="cs1-bash"
169
204
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/).
205
+
::: zone-end
170
206
171
207
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.
172
208
173
209
::: zone pivot="cs1-bash"
174
210
```bash
175
211
sudo docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=<YourStrong!Passw0rd>' \
@@ -200,7 +244,7 @@ Setting `-h` and `--name` to the same value is a good way to easily identify the
200
244
|**-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. |
201
245
|**-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. |
202
246
|**--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. |
203
-
|**mcr.microsoft.com/mssql/server:2019-CTP2.4-ubuntu**| The SQL Server 2019 CTP 2.4 Linux container image. |
247
+
|**mcr.microsoft.com/mssql/server:2019-CTP2.5-ubuntu**| The SQL Server 2019 CTP 2.5 Linux container image. |
204
248
205
249
3. To view your Docker containers, use the `docker ps` command.
206
250
@@ -216,6 +260,12 @@ Setting `-h` and `--name` to the same value is a good way to easily identify the
216
260
```
217
261
::: zone-end
218
262
263
+
::: zone pivot="cs1-cmd"
264
+
```cmd
265
+
docker ps -a
266
+
```
267
+
::: zone-end
268
+
219
269
You should see output similar to the following screenshot:
@@ -244,7 +294,7 @@ The **SA** account is a system administrator on the SQL Server instance that get
244
294
245
295
1. Choose a strong password to use for the SA user.
246
296
247
-
1. Use `docker exec` to run **sqlcmd** to change the password using Transact-SQL. Replace `<YourStrong!Passw0rd>` and `<YourNewStrong!Passw0rd>` with your own password values.
297
+
1. Use `docker exec` to run **sqlcmd** to change the password using Transact-SQL. In the following example, replace the old password, `<YourStrong!Passw0rd>`, and the new password, `<YourNewStrong!Passw0rd>`, with your own password values.
248
298
249
299
::: zone pivot="cs1-bash"
250
300
```bash
@@ -262,6 +312,14 @@ The **SA** account is a system administrator on the SQL Server instance that get
-Q "ALTER LOGIN SA WITH PASSWORD='<YourNewStrong!Passw0rd>'"
320
+
```
321
+
::: zone-end
322
+
265
323
## Connect to SQL Server
266
324
267
325
The following steps use the SQL Server command-line tool, **sqlcmd**, inside the container to connect to SQL Server.
@@ -280,6 +338,12 @@ The following steps use the SQL Server command-line tool, **sqlcmd**, inside the
280
338
```
281
339
::: zone-end
282
340
341
+
::: zone pivot="cs1-cmd"
342
+
```cmd
343
+
docker exec -it sql1 "bash"
344
+
```
345
+
::: zone-end
346
+
283
347
2. Once inside the container, connect locally with sqlcmd. Sqlcmd is not in the path by default, so you have to specify the full path.
284
348
285
349
```bash
@@ -379,46 +443,62 @@ The following steps use **sqlcmd** outside of your container to connect to SQL S
379
443
380
444
1. Find the IP address for the machine that hosts your container. On Linux, use **ifconfig** or **ip addr**. On Windows, use **ipconfig**.
381
445
382
-
2. Run sqlcmd specifying the IP address and the port mapped to port 1433 in your container. In this example, that is the same port, 1433, on the host machine. If you specified a different mapped port on the host machine, you would use it here.
446
+
1. For this example, install the **sqlcmd** tool on your client machine. For more information, see [Install sqlcmd on Windows](../tools/sqlcmd-utility.md) or [Install sqlcmd on Linux](sql-server-linux-setup-tools.md).
447
+
448
+
1. Run sqlcmd specifying the IP address and the port mapped to port 1433 in your container. In this example, that is the same port, 1433, on the host machine. If you specified a different mapped port on the host machine, you would use it here.
383
449
384
450
::: zone pivot="cs1-bash"
385
451
```bash
386
-
sqlcmd -S 10.3.2.4,1433 -U SA -P '<YourNewStrong!Passw0rd>'
452
+
sqlcmd -S <ip_address>,1433 -U SA -P '<YourNewStrong!Passw0rd>'
387
453
```
388
454
::: zone-end
389
455
390
456
::: zone pivot="cs1-powershell"
391
457
```PowerShell
392
-
sqlcmd -S 10.3.2.4,1433 -U SA -P "<YourNewStrong!Passw0rd>"
458
+
sqlcmd -S <ip_address>,1433 -U SA -P "<YourNewStrong!Passw0rd>"
393
459
```
394
460
::: zone-end
395
461
396
-
3. Run Transact-SQL commands. When finished, type `QUIT`.
462
+
::: zone pivot="cs1-cmd"
463
+
```cmd
464
+
sqlcmd -S <ip_address>,1433 -U SA -P "<YourNewStrong!Passw0rd>"
465
+
```
466
+
::: zone-end
467
+
468
+
1. Run Transact-SQL commands. When finished, type `QUIT`.
397
469
398
470
Other common tools to connect to SQL Server include:
399
471
400
472
-[Visual Studio Code](sql-server-linux-develop-use-vscode.md)
401
473
-[SQL Server Management Studio (SSMS) on Windows](sql-server-linux-manage-ssms.md)
402
474
-[Azure Data Studio](../azure-data-studio/what-is.md)
If you want to remove the SQL Server container used in this tutorial, run the following commands:
408
481
409
-
::: zone pivot="cs1-bash"
410
-
```bash
482
+
::: zone pivot="cs1-bash"
483
+
```bash
411
484
sudo docker stop sql1
412
485
sudo docker rm sql1
413
-
```
414
-
::: zone-end
486
+
```
487
+
::: zone-end
415
488
416
-
::: zone pivot="cs1-powershell"
417
-
```PowerShell
489
+
::: zone pivot="cs1-powershell"
490
+
```PowerShell
418
491
docker stop sql1
419
492
docker rm sql1
420
-
```
421
-
::: zone-end
493
+
```
494
+
::: zone-end
495
+
496
+
::: zone pivot="cs1-cmd"
497
+
```cmd
498
+
docker stop sql1
499
+
docker rm sql1
500
+
```
501
+
::: zone-end
422
502
423
503
> [!WARNING]
424
504
> Stopping and removing a container permanently deletes any SQL Server data in the container. If you need to preserve your data, [create and copy a backup file out of the container](tutorial-restore-backup-in-sql-server-container.md) or use a [container data persistence technique](sql-server-linux-configure-docker.md#persist).
If you are having difficulty connecting to your Linux SQL Server, there are a few things to check.
24
+
If you are having difficulty connecting to your Linux SQL Server, there are a few things to check.
25
+
26
+
- If you are unable to connect locally using **localhost**, try using the IP address 127.0.0.1 instead. It is possible that **localhost** is not properly mapped to this address.
25
27
26
28
- Verify that the server name or IP address is reachable from your client machine.
27
29
@@ -188,7 +190,7 @@ As a last resort, you can choose to rebuild the master and model databases back
188
190
189
191
## Improve performance
190
192
191
-
There are many factors that affect performance, including database design, hardware, and workload demands. If you are looking to improve performance, start by reviewing the best practices in the article, [Performance best practices and configuration guidelines for SQL Server on Linux](sql-server-linux-performance-best-practices.md). Then explore some of the avilable tools for troubleshooting performance problems.
193
+
There are many factors that affect performance, including database design, hardware, and workload demands. If you are looking to improve performance, start by reviewing the best practices in the article, [Performance best practices and configuration guidelines for SQL Server on Linux](sql-server-linux-performance-best-practices.md). Then explore some of the available tools for troubleshooting performance problems.
Copy file name to clipboardExpand all lines: docs/relational-databases/system-catalog-views/sys-sensitivity-classifications-transact-sql.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,10 +56,13 @@ Returns a row for each classified item in the database.
56
56
57
57
The following example returns a table listing the table name, column name, label, label ID, information type, information type ID for each classified column in the database.
58
58
59
+
> [!NOTE]
60
+
> Label is a keyword for Azure SQL Data Warehouse.
61
+
59
62
```sql
60
63
SELECT
61
64
sys.all_objects.name AS TableName, sys.all_columns.name As ColumnName,
[!INCLUDE[msCoName](../../includes/msconame-md.md)][!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] uses reserved keywords for defining, manipulating, and accessing databases. Reserved keywords are part of the grammar of the [!INCLUDE[tsql](../../includes/tsql-md.md)] language that is used by [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] to parse and understand [!INCLUDE[tsql](../../includes/tsql-md.md)] statements and batches. Although it is syntactically possible to use [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] reserved keywords as identifiers and object names in [!INCLUDE[tsql](../../includes/tsql-md.md)] scripts, you can do this only by using delimited identifiers.
28
28
29
-
The following table lists [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] and SQL Data Warehouse reserved keywords.
29
+
The following table lists [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] and Azure SQL Data Warehouse reserved keywords.
The following table lists reserved keywords that are exclusive to **SQL Data Warehouse**.
96
+
The following table lists reserved keywords that are exclusive to **Azure SQL Data Warehouse**.
97
97
98
98
|||
99
99
|-|-|
100
-
|**Label**||
100
+
|**LABEL**||
101
101
102
102
Additionally, the ISO standard defines a list of reserved keywords. Avoid using ISO reserved keywords for object names and identifiers. The ODBC reserved keyword list, shown in the following table, is the same as the ISO reserved keyword list.
0 commit comments