Until you put Ubuntu 20 on Windows 10 Home and WSL2 and run Docker

Overview

As the title suggests, it is an article that summarizes the points to successfully start Docker in a VM with Linux (Ubuntu20) using Windows Subsystem for Linux (WSL) 2 on a Windows10 Home Edition machine. .. Almost a memorandum.

Background

For a long time, I was motivated to run Linux on Vagrant & VirtualBox, but recently (October 2020) I learned that WSL works on Windows 10 Home edition with version 2, so I tried it on my home PC. Saw.

procedure

1. Check Windows version

Home edition premise story. Use Win + R to bring up the" Run "dialog and enter winver. Since the "Windows version information" dialog is displayed, confirm that version 1903 and OS build 18362 have been reached.

2. Install WSL2 and Ubuntu20

https://docs.microsoft.com/ja-jp/windows/wsl/install-win10 About the same as this. I feel that Ubuntu is a different version I like.

3. Supports systemctl Ugokanai phenomenon

This phenomenon was the most troublesome this time since I logged in to the VM. With some commands such as systemctl

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

Will come out. "Process ID (PID) No. 1 cannot be operated because systemd is not running". You can check this immediately by typing ps aux in the command. PID = 1 is occupied by the command / init. It seems to be a phenomenon peculiar to WSL2. It seems that other people are in trouble with this, and it is taken up in the WSL official issue, so it seems that it will be solved in a later version upgrade.

Well, at the moment, the solution is that there is a project dedicated to this and the program has already been released. https://github.com/arkane-systems/genie It seems to work on .NET, so put this in. Actually, the installation procedure has already been written on a good site, but it seems that the installation method of this project has changed, and even if I imitated the method of other sites, it got moss on the way. Therefore, I will leave the procedure I did here.

3-1. Install .NET runtime

https://docs.microsoft.com/ja-jp/dotnet/core/install/linux-debian Refer to the item of Debian 10 here. Installation can be done at runtime instead of SDK. My procedure is as follows.

wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt update
sudo apt install -y dotnet-runtime-3.1

3-2. Install genie

You can get a general idea by reading the readme of the genie project. I did the following. The procedure around here has changed and it was not possible to imitate other sites. Perhaps this procedure is no longer available.

sudo touch /etc/apt/sources.list.d/wsl-translinux.list

sudo echo 'deb [trusted=yes] https://wsl-translinux.arkane-systems.net/apt/ /' > /etc/apt/sources.list.d/wsl-translinux.list

sudo apt update
sudo apt install -y systemd-genie

genie -s

The last genie command is required every time you log in, so it may be better to register it in .bashrc etc. With this command, PID = 1 is set to systemd when confirmed by ps aux.

4 Docker (and Docker Compose) installation

Well, I don't think there is any need for explanation after this.

sudo apt install docker.io
sudo apt install docker-compose

sudo groupadd docker
sudo gpasswd -a $USER docker
sudo systemctl restart docker

(You may not need sudo groupadd docker. I got an error because there is already a docker group)

Sorry for the scribble. that's all

Recommended Posts

Until you put Ubuntu 20 on Windows 10 Home and WSL2 and run Docker
Until you run apache on ubuntu on docker
Using Docker on Windows10 Home WSL2
Until you run Quarkus and run docker image on Amazon ECS
Eh !? Run Linux on Windows? I can do it! !! (I set WSL2 and put Ubuntu)
Run NordVPN on Docker (Windows) Ubuntu container
Until you run CuPy (v11.1) on Ubuntu 20.04
Docker on Ubuntu18.04 on WSL2 and VSCode installation instructions
Easily build Redmine on Windows using WSL2 and Docker
Run openvpn on Docker (windows)
Try Docker on Windows 10 Home
Ssh to Ubuntu on VirtualBox on your Mac and do it until you install Docker
Use Docker Compose on Windows 10 Home
Try Docker on Windows Home (September 2020)
Until you build the docker environment and start / stop the Ubuntu container
Introducing Docker Desktop for Windows on WSL2
Try putting Docker in ubuntu on WSL
The story of fighting ubuntu errors 0x80370114, 0x80000000 to enable docker desktop with wsl2 on windows10 home
Run Ubuntu + ROS with Docker on Mac
Put Zabbix in Ubuntu with Docker and monitor Docker on the same host
Installing Docker Desktop on Windows 10 Home was easy and easy (as of December 2020)
Until Docker Desktop is installed and started (Windows10)
Operate Docker Desktop for Windows on Linux (WSL)
Build a Doker-based development environment on Windows 10 Home 2020 ver. Part 1 Until WSL2-based Docker build
Install Ubuntu 20.04 in virtual box on windows10 and build a development environment using docker
I built an Ubuntu environment on Windows 10 using WSL2.
A memo when building a Rails 5.2 development environment using Docker Desktop + WSL2 on Windows 10 Home
I tried using Docker Desktop for Windows on Windows 10 Home
Put JetBrains on Ubuntu
Install rbenv with apt on ubuntu and put ruby
ubuntu on wsl part 10
Run tiscamera on Ubuntu 18.04
M.S. docker on Windows
Docker installation on WSL2
Talk about introducing Ubuntu 20.04 on Windows 10 and text editor
Run phpunit on Docker
How to create an environment that uses Docker (WSL2) and Vagrant (VirtualBox) together on Windows
Until you start nginx on CentOS using Docker on Mac OS
Install docker and docker-compose on ubuntu in the shortest process
Install Docker on Windows 10 PRO
Put Ubuntu 20.04.1 on Raspberry Pi 4
Run VS Code on Docker
Install Docker on Ubuntu Server 20.04
Ubuntu on Windows Community Preview
Latest docker installation (Ubuntu 20.04 and Ubuntu 20.10)
Oracle Java 8 on Docker Ubuntu
Install Java on WSL Ubuntu 18.04
Ruby installation on WSL2 + Ubuntu 20.04
Run chromium-mir-kiosk on Ubuntu Core
Ubuntu on Windows build speed
Run java applet on ubuntu
Run Eclipse CDT on Ubuntu
Install Docker and docker-compose on Raspberry Pi 4, Linux (Debian) and Windows 10, respectively
Ubuntu on WSL2: Cannot connect to the Docker daemon at unix
Create Dockerfile, docker-compose.yml and run nodejs on windows10, Linux, Raspberry Pi
Building a haskell environment with Docker + VS Code on Windows 10 Home
Install Ubuntu20.04 on RaspberryPi 4 and build Kubernetes to run the container
Install Docker on Ubuntu and set up remote connection using tls
[Windows] WSL2 + Ubuntu + Node.js environment construction
Steps to run docker on Mac
Install JDK and JRE on Ubuntu 16.10