{"id":52293,"date":"2019-11-05T00:00:00","date_gmt":"2019-11-04T21:00:00","guid":{"rendered":"https:\/\/prohoster.info\/blog\/blog_prohoster\/razrabotka-s-docker-na-windows-subsystem-for-linux-wsl"},"modified":"2020-02-18T13:59:59","modified_gmt":"2020-02-18T10:59:59","slug":"razrabotka-s-docker-na-windows-subsystem-for-linux-wsl","status":"publish","type":"post","link":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/razrabotka-s-docker-na-windows-subsystem-for-linux-wsl","title":{"rendered":"Development with Docker on Windows Subsystem for Linux (WSL)","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p><img decoding=\"async\" alt=\"Development with Docker on Windows Subsystem for Linux (WSL)\" src=\"\/wp-content\/uploads\/2019\/11\/8b57f485d965eda4f8179ce6a72da724.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p>For full functionality with a Docker project in WSL, WSL 2 must be installed. At the time of writing this note, its use is only possible through participation in the Windows Insider Program (WSL 2 is available in builds 18932 and later). It is also worth mentioning that Windows 10 Pro is required for the installation and configuration of Docker Desktop.<\/p>\n<p>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h3>First Steps<\/h3>\n<p><\/p>\n<p>After joining the Insider Program and installing updates, you need to install a Linux distribution (in this example, Ubuntu 18.04) and Docker Desktop with WSL 2 Tech Preview:<\/p>\n<p><\/p>\n<ol>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/docs.docker.com\/docker-for-windows\/wsl-tech-preview\/\">Docker Desktop WSL 2 Tech Preview<\/a><\/noindex> <\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/www.microsoft.com\/store\/productId\/9N9TNGVNDL3Q\">Ubuntu 18.04 from Windows Store<\/a><\/noindex><\/li>\n<\/ol>\n<p><\/p>\n<p>In both cases, follow all instructions for installation and configuration.<\/p>\n<p><\/p>\n<h3>Installing Ubuntu 18.04 Distribution<\/h3>\n<p><\/p>\n<p>Before starting Ubuntu 18.04, you need to enable Windows WSL and Windows Virtual Machine Platform by executing two commands in PowerShell:<\/p>\n<p><\/p>\n<ol>\n<li><code>Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux<\/code> (will require a restart of the computer)<\/li>\n<li><code>Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform<\/code><\/li>\n<\/ol>\n<p><\/p>\n<p>After that, you need to ensure that we will use WSL v2. To do this, run the following commands in the WSL terminal or PowerShell:<\/p>\n<p><\/p>\n<ul>\n<li><code>wsl -l -v<\/code> \u2014 check which version is currently installed. If it is 1, proceed down the list<\/li>\n<li><code>wsl --set-version ubuntu 18.04 2<\/code> \u2014 to upgrade to version 2<\/li>\n<li><code>wsl -s ubuntu 18.04<\/code> \u2014 set Ubuntu 18.04 as the default distribution<\/li>\n<\/ul>\n<p><\/p>\n<p>Now you can launch Ubuntu 18.04, perform the setup (specify username and password).<\/p>\n<p><\/p>\n<h3>Installing Docker Desktop<\/h3>\n<p><\/p>\n<p>During the installation process, follow the instructions. The computer will require a restart after installation and during the first launch to enable Hyper-V (the version of Windows 10 Pro is required for this).<\/p>\n<p><\/p>\n<p><b>Important!<\/b> If Docker Desktop reports a block by the firewall, go to the antivirus settings and make the following changes to the firewall rules (in this example, Kaspersky Total Security is used):<\/p>\n<p><\/p>\n<ul>\n<li>Go to Settings -&gt; Protection -&gt; Firewall -&gt; Configure Network Rules -&gt; Local Service (TCP) -&gt; Edit<\/li>\n<li>From the list of local ports, remove port 445<\/li>\n<li>Save<\/li>\n<\/ul>\n<p><\/p>\n<p>After starting Docker Desktop, select the WSL 2 Tech Preview option from its context menu.<\/p>\n<p>\n<img decoding=\"async\" alt=\"Development with Docker on Windows Subsystem for Linux (WSL)\" src=\"\/wp-content\/uploads\/2019\/11\/ecd4557904a45f98f2b9147a4e28e23a.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<\/p>\n<p>In the opened window, click the Start button.<\/p>\n<p>\n<img decoding=\"async\" alt=\"Development with Docker on Windows Subsystem for Linux (WSL)\" src=\"\/wp-content\/uploads\/2019\/11\/5a0fa02cd1fd5358294a1de8ded32e9f.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<\/p>\n<p>Now docker and docker-compose are available inside the WSL distribution.<\/p>\n<p><\/p>\n<p><b>Important!<\/b> In the updated Docker Desktop, there is now a tab with WSL inside the settings window. There you can enable WSL support.<\/p>\n<p>\n<img decoding=\"async\" alt=\"Development with Docker on Windows Subsystem for Linux (WSL)\" src=\"\/wp-content\/uploads\/2019\/11\/31c015662c95156ddb2aa7a1a4de5f57.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<\/p>\n<p><b>Important!<\/b> In addition to enabling WSL, you also need to activate your WSL distribution in the Resources -&gt; WSL Integration tab.<\/p>\n<p>\n<img decoding=\"async\" alt=\"Development with Docker on Windows Subsystem for Linux (WSL)\" src=\"\/wp-content\/uploads\/2019\/11\/89a95a3bbf12201de13f6d80797e566c.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<\/p>\n<h3>Start<\/h3>\n<p><\/p>\n<p>One of the surprises were the many issues that arose when attempting to bring up project containers located in the Windows user directory.<\/p>\n<p><\/p>\n<p>Various errors related to running bash scripts (which usually start during container builds to install necessary libraries and distributions) and other typical Linux development tasks made me consider placing projects directly in the Ubuntu 18.04 user directory.<\/p>\n<p>.<\/p>\n<p>From the solution to the previous problem follows the next: how to work with project files through an IDE installed on Windows. The only 'best practice' I found for myself is working through VSCode (although I am a fan of PhpStorm).<\/p>\n<p><\/p>\n<p>After downloading and installing VSCode, don't forget to install the extension <noindex><a rel=\"nofollow\" href=\"https:\/\/aka.ms\/vscode-remote\/download\/extension\">Remote Development extension pack<\/a><\/noindex>.<\/p>\n<p><\/p>\n<p>After installing the aforementioned extension, simply execute the command <code>code .<\/code> in the project directory while VSCode is running.<\/p>\n<p><\/p>\n<p>In this example, to access the containers through the browser, nginx is required. Installing it via <code>sudo apt-get install nginx<\/code> turned out to be not so straightforward. Initially, it was necessary to update the WSL distribution by running <code>sudo apt update &amp;&amp; sudo apt dist-upgrade<\/code>, and only after that start the nginx installation.<\/p>\n<p><\/p>\n<p><b>Important!<\/b> All local domains are not listed in the \/etc\/hosts file of the Linux distribution (it doesn't even exist there), but in the hosts file (usually located at C:\\Windows\\System32\\drivers\\etc\\hosts) of Windows 10.<\/p>\n<p><\/p>\n<h4>file \u2014 continuous reading of events from one or more local files;<\/h4>\n<p><\/p>\n<p>A more detailed description of each step can be found here:<\/p>\n<p><\/p>\n<ul>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/code.visualstudio.com\/docs\/remote\/wsl\">https:\/\/code.visualstudio.com\/docs\/remote\/wsl<\/a><\/noindex><\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/docs.docker.com\/docker-for-windows\/wsl-tech-preview\/\">https:\/\/docs.docker.com\/docker-for-windows\/wsl-tech-preview\/<\/a><\/noindex><\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/docs.docker.com\/docker-for-windows\/\">https:\/\/docs.docker.com\/docker-for-windows\/<\/a><\/noindex><\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/docs.microsoft.com\/ru-ru\/windows\/wsl\/wsl2-install\">https:\/\/docs.microsoft.com\/ru-ru\/windows\/wsl\/wsl2-install<\/a><\/noindex><\/li>\n<\/ul>\n<p>Source: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/474346\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u043d\u0430 docker&#8217;\u0435 \u0432 WSL \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 WSL 2. \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0437\u0430\u043c\u0435\u0442\u043a\u0438 \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0443\u0447\u0430\u0441\u0442\u0438\u044f \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0446\u0435\u043d\u043a\u0438 Windows (WSL 2 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0432 \u0441\u0431\u043e\u0440\u043a\u0430\u0445 18932 \u0438 \u0432\u044b\u0448\u0435). \u0422\u0430\u043a \u0436\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0432\u0435\u0440\u0441\u0438\u044f Windows 10 Pro \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Docker Desktop. \u041f\u0435\u0440\u0432\u044b\u0435 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-52293","post","type-post","status-publish","format-standard","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/razrabotka-s-docker-na-windows-subsystem-for-linux-wsl\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441 Docker \u043d\u0430 Windows Subsystem for Linux (WSL) | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/razrabotka-s-docker-na-windows-subsystem-for-linux-wsl\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-11-04T21:00:00+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-02-18T10:59:59+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Developing with Docker on Windows Subsystem for Linux (WSL) | ProHoster","description":"For full functionality with.","canonical_url":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/razrabotka-s-docker-na-windows-subsystem-for-linux-wsl","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441 Docker \u043d\u0430 Windows Subsystem for Linux (WSL) | ProHoster","og:description":"\u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441.","og:url":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/razrabotka-s-docker-na-windows-subsystem-for-linux-wsl","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-11-04T21:00:00+00:00","article:modified_time":"2020-02-18T10:59:59+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"52293","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-24 03:10:19","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 11:56:47","updated":"2026-01-24 03:10:19","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/52293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/comments?post=52293"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/52293\/revisions"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/media?parent=52293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/categories?post=52293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/tags?post=52293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}