[Win10 Home Docker environment memo (WSL2 or vagrant)] How to deal with the problem that the loading time of localhost is abnormally long

This Qiita is a memo of the process and result of trying to create a Docker environment.

In conclusion, it was important to ** set up and use WSL2 properly **.

environment

What I wanted to do

I want to run a super funny rails project in a Docker environment.

[What I did 1] Create a Docker environment with Vagrant operation

I found that using WSL2 caused some troublesome problems, so I decided to create a virtual environment with VM ware.

Procedure (miscellaneous)

  1. Install Vagrant
  2. Install Virtual Box
  3. vagrant up , vagrant ssh
  4. At the ssh login destination, the docker command

Conclusion

It takes about 4 or 5 minutes to access localhost and display the top page after rails s.

[What I did 2-1] Docker for windows part-1 with WSL2

Windows 10 Home does not have a Hyper-V environment, but if you use WSL2 well, you can use Docker, so I tried it.

Procedure (miscellaneous)

  1. Install Docker for Windows
  2. Allow WSL2 integration
  3. It was usable

Problems that occurred

Like vagrant, the loading time to access localhost is unusually long ... (5,6 minutes)

[What I did 2-2] Docker for windows part-2 with WSL2

The problem that occurred above was that the loading time was abnormally long.

Cause

Upon investigation, the cause of this seems to be that disk access is taking a long time.

Specifically, in the above [What I did 2-1], ** from the ubuntu terminal with / mnt / c (go to the windows directory), I specified the project I want to run **, loading time Turned out to be abnormally long

solution

** Instead of going to the windows directory in / mnt / c, create a project on ubuntu where you want to run docker and run it. ** **

The loading time is about 10s.

Summary

Building a docker environment on Windows 10 Home is really annoying: thumbsdown:

However, if you set WSL2 properly, you can build an environment much faster than VM.

Recommended Posts

[Win10 Home Docker environment memo (WSL2 or vagrant)] How to deal with the problem that the loading time of localhost is abnormally long
How to deal with the error yaml.scanner.ScannerError: while scanning for the next token that appeared in Rails environment construction with Docker
How to deal with `Cannot connect to the Docker daemon at unix: /// var/run/docker.sock. Is the docker daemon running?`
[Docker environment] How to deal with ActiveSupport :: MessageEncryptor :: InvalidMessage
How to create an environment that uses Docker (WSL2) and Vagrant (VirtualBox) together on Windows
I tried to build the environment of WSL2 + Docker + VSCode
How to solve the problem that you can not pull image from docker hub with Minikube
How to build an environment with Docker, which is the minimum required to start a Rails application
The story of fighting ubuntu errors 0x80370114, 0x80000000 to enable docker desktop with wsl2 on windows10 home
I tried to build the environment of PlantUML Server with Docker
Install Docker with WSL2 Memo ([Part 1] Until WSL2 is installed) * The version that did not follow the official Doc
[WSL] Solution for the phenomenon that 404 is displayed when trying to insert Java with apt (personal memo)
How to execute with commands of normal development language in Docker development environment
[swift5] How to change the color of TabBar or the color of item of TabBar with code
How to build Rails 6 environment with Docker
[Laravel] How to deal with out of memory error when composer require [Docker]
How to build an environment of [TypeScript + Vue + Express + MySQL] with Docker ~ Vue edition ~
How to start with Hyper-V instead of WSL2 on Docker Desktop for Windows
The problem that the mount directory of Docker Desktop with WSL2 as the back end becomes strange in Windows Terminal (unsolved as of 2020/08/29?)