Using Devilbox for Local WordPress Development

Using Devilbox for Local WordPress Development



Why not use Docker Desktop?

  1. Maybe I will use Podman in future inside WSL2
  2. Decrease in memory consumption; five times as per source

Using Docker in WSL2 without Docker Desktop

Almost exactly follow this guide.

  1. Remove Docker completely from Windows
# uninstall in normal way

# remove residues if exist
rmdir "%ProgramFiles%\\Docker" /s /q
rmdir "%ProgramData%\\DockerDesktop" /s /q
rmdir "%USERPROFILE%\\.docker" /s /q
rmdir " FILE%\\AppData\\Local\\Docker" /s /q
rmdir "%USERPROFILE%\\AppData\\Roaming\\Docker" /s /q
rmdir "%USERPROFILE%\\AppData\\Roaming\\Docker Desktop" /s /q
  1. Remove Docker completely from WSL2 Complete cleanup Linux guide

    # uninstall old versions
    sudo apt purge -y docker-compose containerd runc
    sudo apt purge -y docker docker-engine docker-ce docker-ce-cli
    # delete all residues
    sudo rm -rf /var/lib/docker /var/lib/containerd /etc/docker ~/.docker /etc/apparmor.d/docker /var/run/docker.sock /usr/local/bin/docker-compose
    sudo groupdel docker
  2. Install Docker in WSL2 from official Docker repository It is similar to official setup

    # set up the repository
    sudo apt update && sudo apt -y upgrade && sudo apt autoremove --purge
    sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
    curl -fsSL | sudo apt-key add -
    sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"
    # install docker engine
    sudo apt update
    sudo apt install docker-compose # this will install everything
    # verify
    sudo docker-compose -v
    sudo service docker start
    sudo docker version
    sudo docker run hello-world

We actually don’t need Docker Desktop to run Docker inside WSL2 Install Docker on Windows (WSL) without Docker Desktop - DEV Community 👩‍💻👨‍💻

Docker on Windows (WSL 2) without Docker Desktop : devops

What is Podman?

Using podman instead of docker on Windows Subsystem for Linux (WSL 2) - DEV Community 👩‍💻👨‍💻 Podman Podman is pretty much a drop-in replacement for Docker when it comes to running images.

Why Podman is worth a look

Docker runs on a client-server architecture, while Podman runs on a daemonless architecture. The Podman architecture by contrast allows you to run the containers under the user that is starting the container (fork/exec), and this user does not need any root privileges.

alias docker=podman

WSL2 Basic Config

From cmd execute:

# shutdown
wsl --shutdown
# ensure nothing is runnning
wsl -l --running

# create/edit WSL config file
notepad "%USERPROFILE%/.wslconfig"

Basic directives:

memory=8GB  # limit memory inside WSL2
swap=0      # no swap file

Wordpress on Devilbox

cd ~
git clone
cd devilbox
cp env-example .env

# configure some interesting variables
id -u; id -g
vi .env

# grep -E "^PHP_MODULES_DISABLE" .env

sudo docker-compose up -d
sudo docker-compose stop
sudo docker-compose rm -f

# so from now on
# once after boot
sudo service docker start
# start
cd ~/devilbox/
# sudo docker-compose up -d
sudo docker-compose up -d bind httpd php mysql redis memcd
# work inside devilbox environment
sudo ./
# end
sudo docker-compose stop

cd /shared/httpd
mkdir "" && cd "$_"
git clone www

mysql -u root -h -p -e "DROP DATABASE IF EXISTS wordpress_b; CREATE DATABASE wordpress_b CHARACTER SET utf8 COLLATE utf8_general_ci; GRANT ALL PRIVILEGES ON wordpress_b.* TO 'wordpress_8' IDENTIFIED BY 'tj7Bo#18PF' WITH GRANT OPTION"

wp db import dump.sql
wp search-replace '' 'weihnachtszeit-dev.loc' --all-tables --dry-run --report-changed-only --precise

wp search-replace '' 'meritplan.loc' --all-tables --report-changed-only
# when I was using `--precise` it didn't replace some Oxygen values?


    cd ~/devilbox/cfg/vhost-gen/`
    cp nginx.yml-example-vhost nginx.yml
    # change this line: server_name *.__VHOST_NAME__;
    # server_name __VHOST_NAME__ *.__VHOST_NAME__;
    # Whenever you adjust nginx.yml, you need to restart the Devilbox
date 05. May 2021 | modified 29. Dec 2023
filename: 2021-05-05 Temp » 2021 Devilbox for Local WP Dev