WSL2 and Docker with Magento 2

logicfusion

Free Member
Jul 2, 2009
519
54
Sheffield
Hi

I'm currently using WSL2 (Windows Subsystem for Linux) for Laravel development having moved over from my Mac. The speed is fantastic and I have no regrets.

I see that Docker now works with WSL2 out the box. Has anyone setup WSL2 / Docker with a Magento 2 image in the container ?

Am I likely to see issues (i.e clashes due to the same network subnets) if I have my Ubuntu WSL2 image running and also a Docker Magento container ?

I ask because as far as I am aware, WSL2 still uses a single VM, - Microsoft refer to this as a, "lightweight utility virtual machine".


Initially, this exercise is purely for me to learn Magento and play with configs. What I don't want is something to bork my current setup!

I like the idea of the Docker containers in principal - as it sound like a great way to spin up separate instances if this is something I end up working on for people.

Or, should I just build up a spare PC to run Linux and shell into it ? :)


Cheers
Al
 

logicfusion

Free Member
Jul 2, 2009
519
54
Sheffield
In case anyone else stumbles across this post, I've managed to get this up and running on Windows 10 WSL with Ubuntu 18.04

The Docker image that worked for me pretty much straight out the box is bitnami/magento; the only exception being I had to add a port mapping in the docker-compose.yml file against the MariaDB port number to allow me to access the DB from my host machine via a SQL client.

For Windows 10 users, this gets you a basic dev system up and running so you can at least have a poke around. MS Visual Code with the Docker extension, takes you straight into the source code on your container.

No doubt I could have remapped the main app server and DB port numbers from 80 and 3306 so as not to clash with my existing setup.

Its not quite point and click, but if you are prepared to invest a little time; its not too hard.
 
Upvote 0

Latest Articles

Join UK Business Forums for free business advice