I wish to install a Drupal web application on DDEV on Docker on WSL 2 and I have found the following instructions overwhelming.
Is there a simpler way?
The instructions I have found
1)
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update && sudo apt-get install ca-certificates curl gnupg lsb-release
2)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
3)
sudo apt-get update && sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo groupadd docker && sudo usermod -aG docker $USER
Post installation script
echo "wsl.exe -u root service docker status > /dev/null || wsl.exe -u root service docker start > /dev/null" >> ~/.bashrc
Windows side instructions
You can then
source ~/.bashrc
to start immediately, or it should start the next time you open git-bash.
- Install mkcert on the Windows side; this may be easiest with Chocolatey: In an administrative PowerShell,
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
In an administrative PowerShell:
choco install -y mkcert
In an administrative PowerShell,
run mkcert -install
and answer the prompt allowing the installation of the Certificate Authority.In an administrative PowerShell, run the command
setx CAROOT "$(mkcert -CAROOT)"; If ($Env:WSLENV -notlike "*CAROOT/up:*") { setx WSLENV "CAROOT/up:$Env:WSLENV" }
.This will set WSL2 to use the Certificate Authority installed on the Windows side. * Double-check in Ubuntu (or your distro): echo
$CAROOT
should show something like/mnt/c/Users/<you>/AppData/Local/mkcert
- Inside your WSL2 distro,
mkcert -install
.