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.
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.
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.
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.
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.
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
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
.
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