How to Successfully Install Magento 2.4 on Windows Using Docker: A Complete Guide

How to Successfully Install Magento 2.4 on Windows Using Docker: A Complete Guide

Setting up Magento 2 on Windows might sound complex, but with Docker, the process becomes significantly easier. This guide explains how to install Magento 2.4 on windows using Docker , making it accessible even if you’re new to containerization.

Steps to Install Magento 2.4 on Windows Using Docker

  1.  Download and Install Docker for Windows

    • Start by downloading Docker for Windows from the official Docker installation guide. Follow the instructions provided to complete the installation.
  2. Install Magento 2.4.

    • Once Docker is installed, open a command prompt and navigate to your desired local folder (e.g., E:\magento\magento2). To install Magento 2.4, run the following command
    • composer create-project –repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.6 magento2
    • This will install Magento 2.4.6 in your local directory, ready for configuration.

  3. Configure PHP Settings

    • To avoid memory issues during the Magento installation, modify the user.ini file located in your Magento folder (e.g., E:\magento\magento2\user.ini). Set the memory_limit to 2048M
  4. Download Docker Compose File

  5. Place the Docker Compose File

    • Copy the downloaded docker-compose.yml file into the Docker installation directory, usually located at "C:\Program Files\Docker\Docker" on your Windows machine.
  6. Set Up Magento Using Docker

    • Now that everything is in place, open a command prompt in the Docker installation directory. Run the following commands to start the Docker containers and begin Magento setup:
      •  docker-compose up -d –build
      • docker exec -it web bash
      • ls
      • cd app
    • Once Docker is up and running, open your web browser and navigate to http://localhost:8080/index.php to access PHPMyAdmin and create a new database for Magento.
  7. Install Magento via Command Line

    • With the database created, return to the command prompt and run the following command to install Magento 2.4:  php bin/magento setup:install –base-url=”https://mage246.domain.com/” –base-url-secure=”https://mage246.domain.com/” –db-host=”mysql” –db-name=”mage246″ –db-user=”root” –db-password=”root” –admin-firstname=”admin” –admin-lastname=”admin” –admin-email=”example@gmail.com” –admin-user=”admin” –admin-password=”admin123″ –language=”en_US” –currency=”USD” –timezone=”America/Chicago” –use-rewrites=”1″ –backend-frontname=”admin” –search-engine=elasticsearch7 –elasticsearch-host=”elasticsearch” –elasticsearch-port=9200
  8. Final Magento Setup Commands

    • After the installation completes, finalize the setup by running the following commands to optimize Magento for your Docker environment:
      • php bin/magento s:up
      • php bin/magento s:d:c
      • php bin/magento s:s:d -f
  9. Update Hosts File (if needed)

    • If Magento doesn’t load correctly, try adding an entry to your hosts file located at C:\Windows\System32\drivers\etc\hosts.

By following this guide, you will successfully install Magento 2.4 on Windows using Docker, providing a flexible and efficient development setup.

Link to other related articles, such as “Setting Up Magento Development Environment.

Install Hyva Theme in Magento2.4

Leave a Reply

Your email address will not be published. Required fields are marked *