Mohamed Abbas | Architect Magento | Tech Blogger | Magento Trainer

Mohamed Abbas
Mohamed Abbas
Architect Magento | Tech Blogger | Magento Trainer

Install Magento 2.4.7 Community on Docker WSL

Instructions on how I setup Magento 2 / Adobe commerce on Windows

Step 1:Install and activate Windows WSL2

  • Follow these instructions to setup your windows for linux subsystem

Step 2:Installing Docker Desktop

 Follow the provided instructions to install Docker Desktop on your system.Click Here

  • Once installed, open Docker Desktop, go to Settings > General, and enable the option “Use the WSL 2 based engine”.

  • Navigate to Resources > WSL Integration, and enable “Integration with my default WSL distro”.

  • Apply the changes and restart Docker Desktop.

  • After Docker Desktop has reinitialized, restart your Windows system to ensure all settings are properly configured.

Step 3:Install Ubuntu 20.04 from Microsoft Store

Step 4 : Install magento on docker desktop

  • Launch Ubuntu 22.04.5 with administrator privileges.

  • Open the Ubuntu terminal and navigate to the project root directory.

  • Get Magento community repository using composer.

				
					composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition myshop --ignore-platform-reqs

				
			

Once the installation is complete, check your root directory to ensure all the files have been successfully installed.

 

Step 4 : Setup Docker File

Download  this File and unzip to 
myshop/dev/<docker file>

Step 5 : Docker Build

 Open the Docker and run as adminstrator
 Go to Ubuntu cd myshop/dev/docker
 run this below command

				
					/mysstore/dev/docker$ docker buildx build -t myshop:latest .
				
			
				
					/mysstore/dev/docker$ docker-compose up -d

				
			
				
					/mysstore/dev/docker$ docker-compose restart

				
			

Step 4 : Modify the Nginx configuration file to suit your site’s URL requirements.

Step 5 : Database Creation

Run this cmd in your ubuntu instantce 

				
					docker exec -it mysql mysql -u root -p

				
			

First, we’ll create a database that Magento can write data to. In this example, the database will be called myshop, but you can name it whatever you prefer.

 

				
					CREATE DATABASE myshop;

				
			
				
					USE myshop;

				
			
				
					EXIT;

				
			

Launch Windows PowerShell and execute the following command

 

				
					docker container exec -it -w /var/www/mabbas docker-app-1 /bin/bash

				
			

Run this Command in powershell for Magento database creation

 

				
					php bin/magento setup:install --base-url=http://local.myshop.com/ --db-host=mysql --db-name=myshop --db-user=root --db-password=root --admin-firstname=Admin --admin-lastname=Admin --admin-email=test@admin.com --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago --backend-frontname=admin

				
			

You should now be able to see a blank page like this when access your frontend via configured base-url:

				
					http://local.myshop.com