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
The *Dockerfile* file is used by the `docker build` command to create a container image. This file is a text file named *Dockerfile* that doesn't have an extension.
166
166
167
-
In your terminal, navigate up a directory to the working folder you created at the start. Create a file named *Dockerfile* in your working folder and open it in a text editor. Depending on the type of application you're going to containerize, you'll choose either the ASP.NET Core runtime or the .NET Core runtime. When in doubt, choose the ASP.NET Core runtime, which includes the .NET Core runtime. This tutorial will use the ASP.NET Core runtime image, but the application created in the previous sections is an .NET Core application.
167
+
In your terminal, navigate back one directory to the working folder you created at the start. Create a file named *Dockerfile* in your working folder and open it in a text editor. Depending on the type of application you're going to containerize, you'll choose either the ASP.NET Core runtime or the .NET Core runtime. When in doubt, choose the ASP.NET Core runtime, which includes the .NET Core runtime. This tutorial will use the ASP.NET Core runtime image, but the application created in the previous sections is an .NET Core application.
168
168
169
169
- ASP.NET Core runtime
170
170
@@ -214,42 +214,50 @@ Docker will process each line in the *Dockerfile*. The `.` in the `docker build`
214
214
```console
215
215
> docker images
216
216
REPOSITORY TAG IMAGE ID CREATED SIZE
217
-
myimage latest 38db0eb8f648 4 weeks ago 346MB
218
-
mcr.microsoft.com/dotnet/core/aspnet 3.1 38db0eb8f648 4 weeks ago 346MB
217
+
myimage latest 54240314fe71 4 weeks ago 346MB
218
+
mcr.microsoft.com/dotnet/core/aspnet 3.1 54240314fe71 4 weeks ago 346MB
219
219
```
220
220
221
221
Notice that the two images share the same **IMAGE ID** value. The value is the same between both images because the only command in the *Dockerfile* was to base the new image on an existing image. Let's add two commands to the *Dockerfile*. Each command creates a new image layer with the final command representing the image the **myimage** repository entry points to.
222
222
223
223
```dockerfile
224
224
COPY app/bin/Release/netcoreapp3.1/publish/ app/
225
225
226
-
ENTRYPOINT ["dotnet", "app/myapp.dll"]
226
+
WORKDIR /app
227
+
228
+
ENTRYPOINT ["dotnet", "myapp.dll"]
227
229
```
228
230
229
231
The `COPY` command tells Docker to copy the specified folder on your computer to a folder in the container. In this example, the *publish* folder is copied to a folder named *app* in the container.
230
232
233
+
The `WORKDIR` command changes the **current directory** inside of the container to *app*.
234
+
231
235
The next command, `ENTRYPOINT`, tells Docker to configure the container to run as an executable. When the container starts, the `ENTRYPOINT` command runs. When this command ends, the container will automatically stop.
232
236
233
237
From your terminal, run `docker build -t myimage -f Dockerfile .` and when that command finishes, run `docker images`.
234
238
235
239
```console
236
240
> docker build -t myimage -f Dockerfile .
237
-
Sending build context to Docker daemon 1.624MB
238
-
Step 1/3 : FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
mcr.microsoft.com/dotnet/core/aspnet 3.1 38db0eb8f648 4 weeks ago 346MB
259
+
myimage latest e496e8b22d02 4 seconds ago 346MB
260
+
mcr.microsoft.com/dotnet/core/aspnet 3.1 54240314fe71 4 weeks ago 346MB
253
261
```
254
262
255
263
Each command in the *Dockerfile* generated a layer and created an **IMAGE ID**. The final **IMAGE ID** (yours will be different) is **ddcc6646461b** and next you'll create a container based on this image.
@@ -260,15 +268,15 @@ Now that you have an image that contains your app, you can create a container. Y
The `docker create` command from above will create a container based on the **myimage** image. The output of that command shows you the **CONTAINER ID** (yours will be different) of the created container. To see a list of *all* containers, use the `docker ps -a` command:
267
275
268
276
```console
269
277
> docker ps -a
270
-
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
271
-
ceda87b219a4 myimage "dotnet app/myapp.dll" 4 seconds ago Created gallant_lehmann
278
+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
279
+
9222af24353f myimage "dotnet myapp.dll" 4 seconds ago Created gallant_lehmann
272
280
```
273
281
274
282
### Manage the container
@@ -282,8 +290,8 @@ The following example uses the `docker start` command to start the container, an
282
290
gallant_lehmann
283
291
284
292
> docker ps
285
-
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
286
-
ceda87b219a4 myimage "dotnet app/myapp.dll" 7 minutes ago Up 8 seconds gallant_lehmann
293
+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
294
+
9222af24353f myimage "dotnet myapp.dll" 7 minutes ago Up 8 seconds gallant_lehmann
287
295
```
288
296
289
297
Similarly, the `docker stop` command will stop the container. The following example uses the `docker stop` command to stop the container, and then uses the `docker ps` command to show that no containers are running:
@@ -331,8 +339,8 @@ The following example lists all containers. It then uses the `docker rm` command
331
339
332
340
```console
333
341
> docker ps -a
334
-
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
335
-
ceda87b219a4 myimage "dotnet app/myapp.dll" 19 minutes ago Exited gallant_lehmann
342
+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
343
+
9222af24353f myimage "dotnet myapp.dll" 19 minutes ago Exited gallant_lehmann
Copy file name to clipboardExpand all lines: docs/core/install/dependencies.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,7 +90,7 @@ For more information about .NET Core 2.1 supported operating systems, distributi
90
90
91
91
<!-- markdownlint-disable MD001 -->
92
92
93
-
### Windows 7 / Vista / 8.1 / Server 2008 R2
93
+
### <aname="additional-deps"></a> Windows 7 / Vista / 8.1 / Server 2008 R2 / Server 2012 R2
94
94
95
95
Additional dependencies are required if you're installing the .NET SDK or runtime on the following Windows versions:
96
96
@@ -111,6 +111,10 @@ The requirements above are also required if you come across one of the following
111
111
>
112
112
> \- or -
113
113
>
114
+
> The program can't start because *api-ms-win-cor-timezone-l1-1-0.dll* is missing from your computer. Try reinstalling the program to fix this problem.
115
+
>
116
+
> \- or -
117
+
>
114
118
> The library *hostfxr.dll* was found, but loading it from *C:\\\<path_to_app>\\hostfxr.dll* failed.
Update the products available for installation, then install the .NET Core SDK. In your terminal, run the following commands.
37
+
38
+
```bash
39
+
sudo apt-get update
40
+
sudo apt-get install apt-transport-https
41
+
sudo apt-get update
42
+
sudo apt-get install dotnet-sdk-3.1
43
+
```
44
+
45
+
> [!IMPORTANT]
46
+
> If you receive an error message similar to **Unable to locate package dotnet-sdk-3.1**, see the [Troubleshoot the package manager](#troubleshoot-the-package-manager) section.
47
+
48
+
## Install the ASP.NET Core runtime
49
+
50
+
Update the products available for installation, then install the ASP.NET Core runtime. In your terminal, run the following commands.
51
+
52
+
```bash
53
+
sudo apt-get update
54
+
sudo apt-get install apt-transport-https
55
+
sudo apt-get update
56
+
sudo apt-get install aspnetcore-runtime-3.1
57
+
```
58
+
59
+
> [!IMPORTANT]
60
+
> If you receive an error message similar to **Unable to locate package aspnetcore-runtime-3.1**, see the [Troubleshoot the package manager](#troubleshoot-the-package-manager) section.
61
+
62
+
## Install the .NET Core runtime
63
+
64
+
Update the products available for installation, then install the .NET Core runtime. In your terminal, run the following commands.
65
+
66
+
```bash
67
+
sudo apt-get update
68
+
sudo apt-get install apt-transport-https
69
+
sudo apt-get update
70
+
sudo apt-get install dotnet-runtime-3.1
71
+
```
72
+
73
+
> [!IMPORTANT]
74
+
> If you receive an error message similar to **Unable to locate package dotnet-runtime-3.1**, see the [Troubleshoot the package manager](#troubleshoot-the-package-manager) section.
The `await` operator suspends evaluation of the enclosing [async](../keywords/async.md) method until the asynchronous operation represented by its operand completes. When the asynchronous operation completes, the `await` operator returns the result of the operation, if any. When the `await` operator is applied to the operand that represents already completed operation, it returns the result of the operation immediately without suspension of the enclosing method. The `await` operator doesn't block the thread that evaluates the async method. When the `await` operator suspends the enclosing async method, the control returns to the caller of the method.
13
+
The `await` operator suspends evaluation of the enclosing [async](../keywords/async.md) method until the asynchronous operation represented by its operand completes. When the asynchronous operation completes, the `await` operator returns the result of the operation, if any. When the `await` operator is applied to the operand that represents an already completed operation, it returns the result of the operation immediately without suspension of the enclosing method. The `await` operator doesn't block the thread that evaluates the async method. When the `await` operator suspends the enclosing async method, the control returns to the caller of the method.
14
14
15
15
In the following example, the <xref:System.Net.Http.HttpClient.GetByteArrayAsync%2A?displayProperty=nameWithType> method returns the `Task<byte[]>` instance, which represents an asynchronous operation that produces a byte array when it completes. Until the operation completes, the `await` operator suspends the `DownloadDocsMainPageAsync` method. When `DownloadDocsMainPageAsync` gets suspended, control is returned to the `Main` method, which is the caller of `DownloadDocsMainPageAsync`. The `Main` method executes until it needs the result of the asynchronous operation performed by the `DownloadDocsMainPageAsync` method. When <xref:System.Net.Http.HttpClient.GetByteArrayAsync%2A> gets all the bytes, the rest of the `DownloadDocsMainPageAsync` method is evaluated. After that, the rest of the `Main` method is evaluated.
Copy file name to clipboardExpand all lines: docs/csharp/language-reference/operators/switch-expression.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ The preceding sample shows the basic elements of a switch expression:
18
18
- The *range expression*: The preceding example uses the variable `direction` as the range expression.
19
19
- The *switch expression arms*: Each switch expression arm contains a *pattern*, an optional *case guard*, the `=>` token, and an *expression*.
20
20
21
-
The result of the *switch expression* is the value of the expression of the first *switch expression arm* whose *pattern* matches the *range expression* and whose *cause guard*, if present, evaluates to `true`. The *expression* on the right of the `=>` token can't be an expression statement.
21
+
The result of the *switch expression* is the value of the expression of the first *switch expression arm* whose *pattern* matches the *range expression* and whose *case guard*, if present, evaluates to `true`. The *expression* on the right of the `=>` token can't be an expression statement.
22
22
23
23
The *switch expression arms* are evaluated in text order. The compiler issues an error when a lower *switch expression arm* can't be chosen because a higher *switch expression arm* matches all its values.
0 commit comments