基于 Docker 的应用程序的开发流程Development Process for Docker-Based Applications

用你喜欢的方式开发容器化 .NET 应用程序:主要使用 IDE,可辅以 Visual Studio 和 Visual Studio tools for Docker,;主要使用 CLI/编辑器,可辅以 Docker CLI 和 Visual Studio Code。 Develop containerized .NET applications the way you like, either IDE focused with Visual Studio and Visual Studio tools for Docker or CLI/Editor focused with Docker CLI and Visual Studio Code.

Docker 应用的开发环境Development environment for Docker apps

开发工具选择:IDE 或编辑器Development tool choices: IDE or editor

无论你更青睐内容丰富、功能强大的 IDE 还是轻量、灵活的级编辑器,Microsoft 都可为你提供用于开发 Docker 应用程序的工具。Whether you prefer a full and powerful IDE or a lightweight and agile editor, Microsoft has tools that you can use for developing Docker applications.

Visual Studio(适用于 Windows)。Visual Studio (for Windows). 在使用 Visual Studio 开发基于 Docker 的应用程序时,建议使用已内置的适用于 Docker 的工具随附的 Visual Studio 2017 15.7 或更高版本。When developing Docker-based applications with Visual Studio, it's recommended to use Visual Studio 2017 version 15.7 or later, that comes with tools for Docker already built-in. 通过适用于 Docker 的工具,可以在目标 Docker 环境中开发、运行和验证应用程序。The tools for Docker let you develop, run, and validate your applications directly in the target Docker environment. 可以按 F5,直接在 Docker 主机中运行并调试应用程序(单个容器或多个容器),也可以按 Ctrl+F5,编辑并刷新应用程序,而无需重新生成该容器。You can press F5 to run and debug your application (single container or multiple containers) directly into a Docker host, or press CTRL+F5 to edit and refresh your application without having to rebuild the container. 要开发基于 Docker 的应用,这是功能最强大的选择。This is the most powerful development choice for Docker-based apps.

Visual Studio for Mac。Visual Studio for Mac. 它是一个 IDE,由 Xamarin Studio 演化而来,在 macOS 中运行,从 2017 年下半年开始可支持 Docker。It's an IDE, evolution of Xamarin Studio, running in macOS and supports Docker since mid-2017. 对于使用 Mac 计算机工作而又希望使用功能强大的 IDE 的开发者而言,这应当是理想之选。This should be the preferred choice for developers working in Mac machines who also want to use a powerful IDE.

Visual Studio Code 和 Docker CLIVisual Studio Code and Docker CLI. 如果更青睐支持任何开发语言的轻量级跨平台编辑器,可以使用 Microsoft Visual Studio Code (VS Code) 和 Docker CLI。If you prefer a lightweight and cross-platform editor that supports any development language, you can use Microsoft Visual Studio Code (VS Code) and the Docker CLI. 这是针对 Mac、Linux 和 Windows 的跨平台开发方法。This is a cross-platform development approach for Mac, Linux, and Windows. 此外,Visual Studio Code 还支持 Docker 扩展(例如适用于 Dockerfile 的 IntelliSense)和在编辑器中运行 Docker 命令的快捷任务。Additionally, Visual Studio Code supports extensions for Docker such as IntelliSense for Dockerfiles and shortcut tasks to run Docker commands from the editor.

安装 Docker Desktop 社区版 (CE),可以使用单个 Docker CLI 生成适用于 Windows 和 Linux 的应用。By installing Docker Desktop Community Edition (CE), you can use a single Docker CLI to build apps for both Windows and Linux.

其他资源Additional resources

适用于 Docker 容器的 .NET 语言和框架.NET languages and frameworks for Docker containers

如本指南的前面几节所述,开发 Docker 容器化 .NET 应用程序时,可以使用 .NET Framework、.NET Core 或开放源 Mono 项目。As mentioned in earlier sections of this guide, you can use .NET Framework, .NET Core, or the open-source Mono project when developing Docker containerized .NET applications. 面向 Linux 或 Windows 容器时,根据所使用的 .NET 框架,可以用 C#、F# 或 Visual Basic 语言进行开发。You can develop in C#, F#, or Visual Basic when targeting Linux or Windows Containers, depending on which .NET framework is in use. 有关 .NET 语言的详细信息,请参阅博客文章 The .NET Language Strategy(.NET 语言策略)。For more details about.NET languages, see the blog post The .NET Language Strategy.