{"id":228572,"date":"2020-03-16T09:00:11","date_gmt":"2020-03-16T16:00:11","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=228572"},"modified":"2020-03-16T09:10:46","modified_gmt":"2020-03-16T16:10:46","slug":"visual-studio-code-docker-extension-1-0-better-than-ever","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/visual-studio-code-docker-extension-1-0-better-than-ever\/","title":{"rendered":"Visual Studio Code Docker extension 1.0 &#8211; Better than Ever!"},"content":{"rendered":"<p>We recently released the 1.0 version of our <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-azuretools.vscode-docker\">Visual Studio Code Docker extension<\/a>, which is the first general availability (GA) release. The Docker extension makes it easier to build apps that leverage Docker containers. The extension helps scaffold needed files, build Docker images, debug your app inside a container, and an explorer that makes it easy to take actions on containers and images such as start, stop, inspect, remove, and more.<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-228579 size-large\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/Docker-GA-1024x223.png\" alt=\"Image Docker GA\" width=\"640\" height=\"139\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/Docker-GA-1024x223.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/Docker-GA-300x65.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/Docker-GA-768x167.png 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/Docker-GA-1536x335.png 1536w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/Docker-GA-2048x446.png 2048w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><span style=\"font-size: 10pt;\">Diagram 1: Docker extension 1.0<\/span><\/p>\n<p>This version of the extension gives Python developers an integrated debugging experience as well as specific support for Django and Flask apps. It also provides Python and .NET Core developers with the same support for Compose that Node.js developers already have. <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-azuretools.vscode-docker\">Install the extension<\/a>, or if you already have it installed then it should update automatically. There are several features that will make your Docker container development experience easier and more efficient when scaffolding, running, debugging, and troubleshooting your containerized apps in Visual Studio Code.<\/p>\n<h2><strong>What\u2019s New in 1.0<\/strong><\/h2>\n<p>There are several new features in the 1.0 version of the extension, the following focuses on a few of them.<\/p>\n<h3><strong>Docker Tools Love Python<\/strong><\/h3>\n<p>We heard from many of our Python developers that the extension could do a better job scaffolding the initial Dockerfile, especially when using Django or Flask. Now, when you add Docker files to your workspace, you can select Django or Flask. Based on your response we\u2019ll scaffold the appropriate Dockerfile, debugging tasks, and launch configurations. Don\u2019t worry, we still support a \u201cGeneral\u201d option as well if you want a more generic Dockerfile.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-228580\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/Docker-GA-Release-Scaffold-3.gif\" alt=\"Image Docker GA Release Scaffold 3\" width=\"1622\" height=\"700\" \/><\/p>\n<p><span style=\"font-size: 10pt;\">Diagram 2: Scaffolding a Python Flask Dockerfile<\/span><\/p>\n<h3><strong>Docker Compose or Dockerfile<\/strong><\/h3>\n<p>Compose is great when you want to start more than one service at a time, or even a single service if you need specify Docker \u2018run\u2019 parameters like port mappings, environment variables, volume mappings, and more. That said, if you just need to start a single container with few parameters, using just a Dockerfile might work fine.<\/p>\n<p>The Docker extension now supports using either a Compose.yml file or only a Dockerfile. Additionally, for Node.js, Python, and .NET Core we support integrated debugging of a single service using a Dockerfile. When using the command \u201cDocker: Add Docker Files to Workspace\u201d, the extension places configurations in the tasks.json and launch.json files. This makes debugging your app inside a container just a couple clicks away. On the Debugger panel, choose a Docker configuration and start debugging. An image will be built using the Dockerfile, a container will be started using this image, and then your app will be started inside the container with the debugger attached. You can now use the debugger to set breakpoints and step through your code.<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-228581 size-large\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/Python-Debugging-1024x496.png\" alt=\"Image Python Debugging\" width=\"640\" height=\"310\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/Python-Debugging-1024x496.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/Python-Debugging-300x145.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/Python-Debugging-768x372.png 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/Python-Debugging-1536x744.png 1536w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/Python-Debugging-2048x992.png 2048w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><span style=\"font-size: 10pt;\">Diagram 3: Debug configuration for Python (Flask) in a Docker container<\/span><\/p>\n<h3><strong>Docker Command Customization<\/strong><\/h3>\n<p>When using palette commands or context menus in the explorer, the Docker extension executes commands on your behalf. With the 1.0 release of the extension, you can customize many of these commands. For example, when you run an image, you can now have the extension put the resulting container on a specific network. <a href=\"https:\/\/code.visualstudio.com\/docs\/containers\/reference#_command-customization\">See the documentation<\/a> for details on what commands can be customized.<\/p>\n<h3><strong>Work with Multiple Containers or Images<\/strong><\/h3>\n<p>One of the most asked for features was the ability to select multiple containers or images when executing commands, such as starting\/stopping containers or running\/removing images. You can now select multiple containers or images and then use the context menu to execute a command on all the selected items. In addition, if you run a command from the command palette, such as \u201cDocker Containers: Start\u201d you will see a list of all of the containers that can be started with a checkbox next to each.<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-228592 size-large\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/MultiSelect-1024x787.png\" alt=\"Image MultiSelect\" width=\"640\" height=\"492\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/MultiSelect-1024x787.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/MultiSelect-300x231.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/MultiSelect-768x590.png 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2020\/03\/MultiSelect.png 1403w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><span style=\"font-size: 10pt;\">Diagram 4: Multi-selecting containers to Start\/Stop<\/span><\/p>\n<h3><strong>WSL 2 (Windows Subsystem for Linux 2) Support<\/strong><\/h3>\n<p>If you are running a version of Windows that includes WSL 2, you can enable the WSL 2 experimental engine in Docker Desktop which leverages WSL 2 rather than using HyperV to run Linux containers. As of the 0.9.0 version of the Docker extension, the use of WSL 2 is supported and encouraged!<\/p>\n<h3><strong>And More&#8230;<\/strong><\/h3>\n<p>A few other features you will find helpful in the 1.0 release of the Docker extension are:<\/p>\n<ul>\n<li>Task-based debugging for Node.js, Python, and .NET Core enables customization of \u2018docker build\u2019 and \u2018docker run\u2019 scenarios<\/li>\n<li>New \u201cOpen in Browser\u201d menu added to Containers treeview to quickly open a browser to the exposed port<\/li>\n<li>When scaffolding the Dockerfile for .NET Core, it is now placed next to project file which is much better when multiple projects exist in a repo<\/li>\n<li>The extension pulls the latest image when executing \u2018docker build\u2019 to keep images up to date<\/li>\n<\/ul>\n<h2><strong>Try it Today<\/strong><\/h2>\n<p>If you haven\u2019t already, make sure to\u00a0<a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-azuretools.vscode-docker\">download the Visual Studio Code Docker extension<\/a>. With this release we hope you\u2019ll find scaffolding, running, debugging, and troubleshooting your containerized apps easier and more efficient than ever! We encourage you to leave your comments below or <a href=\"https:\/\/github.com\/microsoft\/vscode-docker\/issues\">submit an issue on the GitHub repo<\/a>. As with many of our Visual Studio Code extensions, the Docker extension is open source! This means you can read the code to learn or jump in and work on the code or docs. Together we can make the experience great for everyone.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We recently released the 1.0 version of our Visual Studio Code Docker extension, which is the first general availability (GA) release. The Docker extension makes it easier to build apps that leverage Docker containers.<\/p>\n","protected":false},"author":3541,"featured_media":228579,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[155],"tags":[361,354,242,3249,3286,185,172,280],"class_list":["post-228572","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio","tag-net-core","tag-announcement","tag-azure","tag-containers","tag-docker","tag-node-js","tag-python","tag-visual-studio-code"],"acf":[],"blog_post_summary":"<p>We recently released the 1.0 version of our Visual Studio Code Docker extension, which is the first general availability (GA) release. The Docker extension makes it easier to build apps that leverage Docker containers.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/228572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/3541"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=228572"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/228572\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/228579"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=228572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=228572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=228572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}