0

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.

1 Answer 1

0

Is there a simpler way?

While I can make that one step easier for you, ultimately you are missing a great deal of the installation instructions, so unfortunately it's likely going to be a bit more complicated, sorry to say.

First, you mention wanting to install a Drupal application via DDEV. Then you link to instructions for installing Docker, but that's just part of the installation process.

First, start with the DDEV-local installation instructions for Windows/WSL2

To summarize those high-level steps:

  • Installing Chocolatey package manager (optional).
  • One time initialization of mkcert.
  • Installing WSL2 and installing a distro like Ubuntu.
  • Installing or upgrading to the latest Docker Desktop for Windows with WSL2 enabled.
  • Installing DDEV inside your distro.

The "detailed" instructions are right below that section, and they are currently 17 steps. The page you linked to is really just the "Step 7" part of those. Make sure you have completed the previous 6 steps first, including installing WSL. Note that those instructions, which reference wsl --install, do require a recent version of Windows 10 or 11 (2021H2 or later).

However, we can at least make the Docker installation step that you linked to a bit easier.

The page you linked to mentions two different methods of installing Docker on Windows:

These instructions probably should be labeled as "Option 1" and "Option 2", or "Alternative installation", or something to make it more clear.

As the instructions say, the "traditional" (a.k.a. "simpler") method is to use Docker Desktop, which will set everything up for you.

Note that Docker Desktop does require a paid license if you are working in a business with more than 250 employees or more than $10m in annual revenue (current information, but future readers should check to see what the requirements are at the time of reading). However, you've come across one of the reasons why, IMHO, it's well worth it -- It will ultimately save you more time/money than the cost of the license (if you require it).

After installing Docker itself (via Docker Desktop), proceed with the other steps of the installation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.