{"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\/no\/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 full functionality with a Docker project in WSL, WSL 2 needs to be installed. At the time of writing this note, its use is only possible as part of the Windows Insider Program (WSL 2 is available in builds 18932 and newer). It\u2019s also worth mentioning that Windows 10 Pro is required for installing and configuring Docker Desktop.<\/p>\n<p>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h3>F\u00f8rste skritt<\/h3>\n<p><\/p>\n<p>After joining the Windows Insider Program and installing the updates, it is necessary to install a Linux distribution (in this example, Ubuntu 18.04 is used) 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 the Windows Store<\/a><\/noindex><\/li>\n<\/ol>\n<p><\/p>\n<p>In both cases, follow all the installation and configuration instructions.<\/p>\n<p><\/p>\n<h3>Installing the 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 computer restart)<\/li>\n<li><code>Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform<\/code><\/li>\n<\/ol>\n<p><\/p>\n<p>Next, you need to make sure that we are going to use WSL v2. To do this, sequentially execute the 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, then proceed to the next items on the list.<\/li>\n<li><code>wsl --set-version ubuntu 18.04 2<\/code> \u2014 to update 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 start Ubuntu 18.04 and complete the setup (specify the 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 on the first run to enable Hyper-V (which is required for Windows 10 Pro).<\/p>\n<p><\/p>\n<p><b>Viktig!<\/b> If Docker Desktop reports a firewall blockage, go to the antivirus settings and make the following changes to the network rules (in this example, Kaspersky Total Security is used as the antivirus):<\/p>\n<p><\/p>\n<ul>\n<li>Navigate 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=\"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 within the WSL distribution.<\/p>\n<p><\/p>\n<p><b>Viktig!<\/b> In the updated Docker Desktop, there is now a tab with WSL inside the settings window. There, WSL support can be enabled.<\/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>Viktig!<\/b> I tillegg til \u00e5 aktivere WSL-flagget m\u00e5 du ogs\u00e5 aktivere WSL-distribusjonen din 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>Start<\/h3>\n<p><\/p>\n<p>Mange problemer oppsto overraskende nok da jeg pr\u00f8vde \u00e5 heve containerne til prosjekter som ligger i brukerens Windows-katalog.<\/p>\n<p><\/p>\n<p>Ulike feil relatert til kj\u00f8ring av bash-skript (som vanligvis starter ved bygging av containere for \u00e5 installere n\u00f8dvendige biblioteker og distribusjoner) og andre vanlige utviklingsoppgaver for Linux fikk meg til \u00e5 vurdere \u00e5 plassere prosjektene direkte i brukerens katalog for Ubuntu 18.04.<\/p>\n<p>.<\/p>\n<p>Fra l\u00f8sningen p\u00e5 det forrige problemet f\u00f8lger det neste: hvordan jobbe med prosjektfiler gjennom en IDE installert p\u00e5 Windows. Som 'beste praksis' fant jeg kun \u00e9n l\u00f8sning \u2014 \u00e5 jobbe via VSCode (selv om jeg er fan av PhpStorm).<\/p>\n<p><\/p>\n<p>Etter nedlasting og installasjon av VSCode, installer n\u00f8dvendigvis utvidelsen <noindex><a rel=\"nofollow\" href=\"https:\/\/aka.ms\/vscode-remote\/download\/extension\">Remote Development extension pack<\/a><\/noindex>.<\/p>\n<p><\/p>\n<p>Etter installasjonen av den nevnte utvidelsen er det bare \u00e5 utf\u00f8re kommandoen <code>code .<\/code> i prosjektkatalogen n\u00e5r VSCode er \u00e5pnet.<\/p>\n<p><\/p>\n<p>I dette eksempelet er nginx n\u00f8dvendig for \u00e5 f\u00e5 tilgang til containerne gjennom nettleseren. Installer det ved \u00e5 bruke <code>sudo apt-get install nginx<\/code> var ikke s\u00e5 enkelt. F\u00f8rst m\u00e5tte jeg oppdatere WSL-distribusjonen ved \u00e5 kj\u00f8re <code>sudo apt update &amp;&amp; sudo apt dist-upgrade<\/code>, og f\u00f8rst etter det kunne jeg starte installasjonen av nginx.<\/p>\n<p><\/p>\n<p><b>Viktig!<\/b> Alle lokale domener skrives ikke i filen \/etc\/hosts til Linux-distribusjonen (den finnes ikke engang), men i hosts-filen (vanligvis plassert i C:WindowsSystem32driversetchosts) p\u00e5 Windows 10.<\/p>\n<p><\/p>\n<h4>Kilder<\/h4>\n<p><\/p>\n<p>En mer detaljert beskrivelse av hvert steg kan finnes 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.5 - 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\/no\/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.5\" \/>\n\t\t<meta property=\"og:locale\" content=\"nn_NO\" \/>\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\/no\/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\udd47Utvikling med Docker p\u00e5 Windows Subsystem for Linux (WSL) | ProHoster","description":"For fullverdig arbeid med.","canonical_url":"https:\/\/prohoster.info\/no\/blog\/administrirovanie\/razrabotka-s-docker-na-windows-subsystem-for-linux-wsl","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"nn_NO","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\/no\/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\/no\/wp-json\/wp\/v2\/posts\/52293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/no\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/no\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/no\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/no\/wp-json\/wp\/v2\/comments?post=52293"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/no\/wp-json\/wp\/v2\/posts\/52293\/revisions"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/no\/wp-json\/wp\/v2\/media?parent=52293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/no\/wp-json\/wp\/v2\/categories?post=52293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/no\/wp-json\/wp\/v2\/tags?post=52293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}