Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 28aeba3

Browse files
committed
Adding a 2019 section of the Docker quickstart
1 parent e1ec84a commit 28aeba3

1 file changed

Lines changed: 96 additions & 8 deletions

File tree

docs/linux/quickstart-install-connect-docker.md

Lines changed: 96 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
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.
44
author: rothja
55
ms.author: jroth
66
manager: craigg
@@ -14,11 +14,11 @@ ms.custom: "sql-linux"
1414
ms.prod_service: linux
1515
ms.assetid: 82737f18-f5d6-4dce-a255-688889fdde69
1616
---
17-
# Quickstart: Run the SQL Server 2017 container image with Docker
17+
# Quickstart: Run SQL Server container images with Docker
1818

1919
[!INCLUDE[appliesto-ss-xxxx-xxxx-xxx-md-linuxonly](../includes/appliesto-ss-xxxx-xxxx-xxx-md-linuxonly.md)]
2020

21-
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.
2222

2323
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.
2424

@@ -32,7 +32,10 @@ This image consists of SQL Server running on Linux based on Ubuntu 16.04. It can
3232
- Minimum of 2 GB of RAM
3333
- [System requirements for SQL Server on Linux](sql-server-linux-setup.md#system).
3434

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-->
37+
::: moniker range="= sql-server-linux-2017 || = sql-server-2017 || =sqlallproducts-allversions"
38+
## <a id="pullandrun2017"></a> Pull and run the container image
3639

3740
1. Pull the SQL Server 2017 Linux container image from Docker Hub.
3841

@@ -44,11 +47,14 @@ This image consists of SQL Server running on Linux based on Ubuntu 16.04. It can
4447
docker pull microsoft/mssql-server-linux:2017-latest
4548
```
4649

50+
> [!TIP]
51+
> 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+
4753
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/).
4854

4955
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/).
5056

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.
5258

5359
```bash
5460
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
7884
| **--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. |
7985
| **microsoft/mssql-server-linux:2017-latest** | The SQL Server 2017 Linux container image. |
8086

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:
98+
99+
![Docker ps command output](./media/sql-server-linux-setup-docker/docker-ps-command.png)
100+
101+
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-->
117+
::: moniker range="= sql-server-linux-ver15 || = sql-server-ver15"
118+
## <a id="pullandrun2019"></a> Pull and run the container image
119+
120+
1. Pull the SQL Server 2019 CTP 2.0 Linux container image from Docker Hub.
121+
122+
```bash
123+
sudo docker pull microsoft/mssql-server-linux:2019-latest
124+
```
125+
126+
```PowerShell
127+
docker pull microsoft/mssql-server-linux:2019-latest
128+
```
129+
130+
> [!TIP]
131+
> 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.
82168

83169
```bash
84170
sudo docker ps -a
@@ -92,7 +178,7 @@ This image consists of SQL Server running on Linux based on Ubuntu 16.04. It can
92178

93179
![Docker ps command output](./media/sql-server-linux-setup-docker/docker-ps-command.png)
94180

95-
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).
96182

97183
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:
98184

@@ -104,6 +190,8 @@ SELECT @@SERVERNAME,
104190
```
105191

106192
Setting `-h` and `--name` to the same value is a good way to easily identify the target container.
193+
::: moniker-end
194+
<!--End of 2019 "Pull and run" section-->
107195

108196
## Change the SA password
109197

0 commit comments

Comments
 (0)