{"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\/da\/blog\/administrirovanie\/razrabotka-s-docker-na-windows-subsystem-for-linux-wsl","title":{"rendered":"Udvikling med Docker p\u00e5 Windows Subsystem for Linux (WSL)","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p><img decoding=\"async\" alt=\"Udvikling med Docker p\u00e5 Windows Subsystem for Linux (WSL)\" src=\"\/wp-content\/uploads\/2019\/11\/8b57f485d965eda4f8179ce6a72da724.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p>For a full-fledged operation of a project on Docker in WSL, WSL 2 must be installed. At the time of writing, its use is only possible as part of the Windows Insider Program (WSL 2 is available in builds 18932 and higher). It is also worth mentioning that a Windows 10 Pro version 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, it is necessary to install the Linux distribution (Ubuntu 18.04 is used in this example) 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 the installation and configuration instructions.<\/p>\n<p><\/p>\n<h3>Installing the Ubuntu 18.04 distribution<\/h3>\n<p><\/p>\n<p>Before launching 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 computer restart)<\/li>\n<li><code>Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform<\/code><\/li>\n<\/ol>\n<p><\/p>\n<p>Next, you need to ensure that we are using WSL v2. For this, in the WSL terminal or PowerShell, execute the following commands in sequence:<\/p>\n<p><\/p>\n<ul>\n<li><code>wsl -l -v<\/code> \u2014 check what version is currently installed. If it is 1, proceed further 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, go through 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 prompts. The computer will require a restart after the installation and at the first launch to enable Hyper-V (due to which Windows 10 Pro is required).<\/p>\n<p><\/p>\n<p><b>Vigtigt!<\/b> If Docker Desktop reports a block from the firewall, go to the antivirus settings and make the following changes to the firewall rules (in this example, Kaspersky Total Security is used as the antivirus):<\/p>\n<p><\/p>\n<ul>\n<li>Go to Settings -&gt; Protection -&gt; Firewall -&gt; Configure packet rules -&gt; Local Service (TCP) -&gt; Change<\/li>\n<li>Remove port 445 from the list of local ports.<\/li>\n<li>Save<\/li>\n<\/ul>\n<p><\/p>\n<p>After launching Docker Desktop, select the WSL 2 Tech Preview option from its context menu.<\/p>\n<p>\n<img decoding=\"async\" alt=\"Udvikling med Docker p\u00e5 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=\"Udvikling med Docker p\u00e5 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>Vigtigt!<\/b> In the updated Docker Desktop, there is now a tab with WSL inside the settings window. Enable support for WSL there.<\/p>\n<p>\n<img decoding=\"async\" alt=\"Udvikling med Docker p\u00e5 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>Vigtigt!<\/b> Udover at aktivere WSL er det ogs\u00e5 n\u00f8dvendigt at aktivere din WSL-distribution i fanen Resources-&gt;WSL Integration.<\/p>\n<p>\n<img decoding=\"async\" alt=\"Udvikling med Docker p\u00e5 Windows Subsystem for Linux (WSL)\" src=\"\/wp-content\/uploads\/2019\/11\/89a95a3bbf12201de13f6d80797e566c.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<\/p>\n<h3>K\u00f8rsel<\/h3>\n<p><\/p>\n<p>En overraskelse var de mange problemer, der opstod, n\u00e5r jeg fors\u00f8gte at starte containerne for projekterne, der l\u00e5 i Windows-brugermappen.<\/p>\n<p><\/p>\n<p>Forskellige fejl relateret til k\u00f8rsel af bash-scripts (som normalt startes under opbygningen af containerne for at installere de n\u00f8dvendige biblioteker og distributioner) og andre ting, der almindeligvis er forbundet med udvikling p\u00e5 Linux, fik mig til at overveje at placere projekterne direkte i Ubuntu 18.04-brugermappen.<\/p>\n<p>.<\/p>\n<p>Fra l\u00f8sningen p\u00e5 det tidligere problem f\u00f8lger det n\u00e6ste: hvordan man arbejder med projektfiler gennem en IDE installeret p\u00e5 Windows. Jeg har kun fundet \u00e9n variant som \"best practice\" \u2014 arbejde via VSCode (selvom jeg er fan af PhpStorm).<\/p>\n<p><\/p>\n<p>Efter download og installation af VSCode er det vigtigt at installere udvidelsen <noindex><a rel=\"nofollow\" href=\"https:\/\/aka.ms\/vscode-remote\/download\/extension\">Remote Development extension pack<\/a><\/noindex>.<\/p>\n<p><\/p>\n<p>Efter installation af den ovenn\u00e6vnte udvidelse er det nok at udf\u00f8re kommandoen <code>code .<\/code> i projektmappen med VSCode \u00e5bnet.<\/p>\n<p><\/p>\n<p>I dette eksempel er nginx n\u00f8dvendig for at f\u00e5 adgang til containerne via browseren. At installere det via <code>sudo apt-get install nginx<\/code> var ikke s\u00e5 ligetil. F\u00f8rst skulle WSL-distributionen opdateres ved at udf\u00f8re <code>sudo apt update &amp;&amp; sudo apt dist-upgrade<\/code>, og f\u00f8rst derefter kunne installationen af nginx startes.<\/p>\n<p><\/p>\n<p><b>Vigtigt!<\/b> Alle lokale dom\u00e6ner er ikke angivet i filen \/etc\/hosts for Linux-distributionen (den findes ikke engang), men i hosts-filen (som normalt ligger C:WindowsSystem32driversetchosts) p\u00e5 Windows 10.<\/p>\n<p><\/p>\n<h4>Kilder<\/h4>\n<p><\/p>\n<p>En mere detaljeret beskrivelse af hvert trin findes her:<\/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>Kilde: <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.3 - 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\/da\/blog\/administrirovanie\/razrabotka-s-docker-na-windows-subsystem-for-linux-wsl\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.3\" \/>\n\t\t<meta property=\"og:locale\" content=\"da_DK\" \/>\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\/da\/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\udd47Udvikling med Docker p\u00e5 Windows Subsystem for Linux (WSL) | ProHoster","description":"For fuld funktionalitet med.","canonical_url":"https:\/\/prohoster.info\/da\/blog\/administrirovanie\/razrabotka-s-docker-na-windows-subsystem-for-linux-wsl","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"da_DK","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\/da\/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\/da\/wp-json\/wp\/v2\/posts\/52293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/comments?post=52293"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/posts\/52293\/revisions"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/media?parent=52293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/categories?post=52293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/tags?post=52293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}