{"id":233,"date":"2024-11-22T18:30:00","date_gmt":"2024-11-22T18:30:00","guid":{"rendered":"https:\/\/imcodinggenius.com\/?p=233"},"modified":"2024-11-22T18:30:00","modified_gmt":"2024-11-22T18:30:00","slug":"install-docker-on-windows-using-wsl2-ubuntu","status":"publish","type":"post","link":"https:\/\/imcodinggenius.com\/?p=233","title":{"rendered":"Install Docker on Windows Using WSL2 Ubuntu"},"content":{"rendered":"<h3>1. What is WSL2?<\/h3>\n<p>Windows Subsystem for Linux (WSL) is a full Linux kernel built by Microsoft that allows you to run a Linux environment on Windows without the need for a separate virtual machine.<br \/>\n  Use WSL to install and run various Linux distributions, such as Ubuntu, Debian, etc.<\/p>\n<h3>2. Install WSL<\/h3>\n<p>a. Open \u2018Turn Windows features on or off\u2019<\/p>\n<p>b. Enable \u2018Windows Subsystem for Linux\u2019<\/p>\n<p>\nFig 1: Enable WSL<\/p>\n<p>c. Run the command \u2018WSL \u2013update\u2019 to update the WSL to the latest version.<\/p>\n<p>d. Run the command \u2018WSL \u2013shutdown\u2019 to shutdown all the instances.<\/p>\n<h3>3. List the Linux distributions<\/h3>\n<p>a. Run the command \u2018WSL \u2013list\u2019 to view the existing distributions.<\/p>\n<p>b. Run the command \u2018WSL \u2013list \u2013online\u2019 to view the list of valid Linux distributions that can be installed.<\/p>\n<p>\nFig 2: Valid Linux distributions<\/p>\n<h3>4. Install Ubuntu<\/h3>\n<p>a. Run the command \u2018WSL \u2013install -d ubuntu\u2019 to install the Ubuntu Linux distribution.<\/p>\n<p>b. After Ubuntu installation, setup your username and password.<\/p>\n<p>\nFig 3: Ubuntu Linux distribution<\/p>\n<p>b. Run the command \u2018exit\u2019 to exit the WSL and close the terminal.<\/p>\n<p>c. Reopen the terminal and choose the Ubuntu<\/p>\n<p>\nFig 4: Ubuntu Terminal<\/p>\n<p>d. You can also switch to Ubuntu from the command prompt or powershell by entering the command \u2018WSL\u2019, which will take you to the default distribution, i.e., Ubuntu here in our case.<\/p>\n<h3>5. Install Docker<\/h3>\n<p>a. Run the command \u2018curl -L https:\/\/get.docker.io | bash\u2019 to get the docker using CURL.<\/p>\n<p>b. Enter your password to proceed with installing the Docker.<\/p>\n<p>\nFig 5: Get Docker using CURL<\/p>\n<h3>6. Docker start<\/h3>\n<p>a. Run the command \u2018sudo service docker start\u2019<\/p>\n<h3>7. List of Docker images<\/h3>\n<p>a. Run the command \u2018docker ps\u2019. You may receive the following error:<\/p>\n<p>\nFig 6: Docker images<\/p>\n<p>b. You may need the Ubuntu user for the network group.<\/p>\n<p>c. Run the command \u2018sudo usermod -aG docker $USER\u2019<\/p>\n<p>d. Run the command \u2018docker ps\u2019 again to view the list of Docker images.<\/p>\n<p>\nFig 6: Docker images<\/p>\n<h3>8. Docker run<\/h3>\n<p>a. Run the command \u2018docker run hello-world\u2019. This command will pull the \u2018Hello World\u2019 image from the Docker hub and run the image in local.<\/p>\n<p>\nFig 7: Docker run &#8212; Hello World<\/p>","protected":false},"excerpt":{"rendered":"<p>1. What is WSL2? Windows Subsystem for Linux (WSL) is a full Linux kernel built by Microsoft that allows you to run a Linux environment on Windows without the need for a separate virtual machine. Use WSL to install and run various Linux distributions, such as Ubuntu, Debian, etc. 2. &#8230; <\/p>\n<div><a class=\"more-link bs-book_btn\" href=\"https:\/\/imcodinggenius.com\/?p=233\">Read More<\/a><\/div>\n","protected":false},"author":0,"featured_media":234,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-233","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"_links":{"self":[{"href":"https:\/\/imcodinggenius.com\/index.php?rest_route=\/wp\/v2\/posts\/233"}],"collection":[{"href":"https:\/\/imcodinggenius.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/imcodinggenius.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/imcodinggenius.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=233"}],"version-history":[{"count":0,"href":"https:\/\/imcodinggenius.com\/index.php?rest_route=\/wp\/v2\/posts\/233\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/imcodinggenius.com\/index.php?rest_route=\/wp\/v2\/media\/234"}],"wp:attachment":[{"href":"https:\/\/imcodinggenius.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/imcodinggenius.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/imcodinggenius.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}