I tried to run docker from wsl and it melted for a whole day so I will record it.
Also, I intentionally wrote "WSL", but the prerequisites are as follows.
--Windows OS build 19041 and above --Being WSL2 --Starting the command prompt with administrator privileges --Docker version is 17.12.1 --You must have an account on docker hub
As mentioned above, it seems that it actually has to be WSL2. However, I spent a whole day at WSL, and I think that there are other people who are in trouble because they are trying hard at WSL, so I intentionally chose this title.
By the way, even WSL1 succeeds until the last hello-world. After that, when I try to put the package using ** apt-get, it doesn't work at all. ** ** Therefore, ** it is recommended to keep it in WSL2 for later work. ** **
You can update from the following page. [https://www.microsoft.com/ja-jp/software-download/windows10:embed:cite]
I proceeded with reference to the following article. [https://dev.classmethod.jp/articles/how-to-setup-wsl2/:embed:cite] By the way, I already had Ubuntu on WSL, so I did the following without installing a new Ubuntu to get my existing Ubuntu to work on WSL2.
wsl --set-version Ubuntu 2
Launch wsl and do the following:
sudo apt install docker.io=17.12.1-0ubuntu1
In addition, add docker as a secondary group to your group.
sudo usermod -aG docker $USER
Do the following:
sudo cgroupfs-mount && sudo service docker start
Make sure it is running with the following command
sudo service docker status
It is OK if it is displayed as follows.
*docker running
Let's run the following to see if it starts successfully.
sudo docker run hello-world
It is OK if it is displayed as follows.
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
Recommended Posts