Magento is an open-source eCommerce store, it is used to manage your business process for selling a product with all functionalities like billing, shipping and we can also add a payment integration with Magento. In the article will see how to install a Magento in Docker environment with a step by step guide. 

SAP Integration Services by Veon Contact Banner

Docker is a development environment platform that uses an operating system(OS) level virtualization once an application is built and can be moved into production. Docker hub contains open-source images like PHP, MYSQL, Apache and we build our own container and pull to docker hub in this article will see step by step guide on how to install Magento 2 in docker below is a screenshot that shows ref representation of docker.

Docker container representation

Application:- it contains source code of the application or packages example Magento 2     Application

Container OS:  Docker is a container-based environment where we can download applications from a docker-hub and link to our application example Apache Server and MYSQL database below a screenshot of a docker container.

Docker container with linked images from docker hub

Operating System: Every application runs on a native platform, Docker is a Linux based application it also contains OS images we can pull into our docker environment Linux based OS like Ubuntu, centos applications are available in docker hub.

  • Applications are installed in a root directory of an operating system.
  • An application can be linked to another container with the help of docker-compose.yml file. 

Hardware: It uses host hardware where you installed your docker environment. Docker can be installed in local machine windows or Linux and we can install docker on platforms like AWS, Azure and hosting services like Digital Ocean, the below screen shows the hardware used by a particular container is a local machine it shows CPU, Memory, hardware and Network usage.

Screenshot of hardware usage by docker container.

In below steps will see step by step installation process of Magento and pull images from a docker hub


Step 1: Download docker file from Github 

To download the docker file in your local machine make sure that Git is installed, to check git install in you machine enter the below command in PowerShell or cmd and press enter

Copy to Clipboard
  • The below screen shows the git version.

Command to check Git Version in windows machine

Navigating to source folder in a command line

  • Enter the following command to download git file 
git clone https://github.com/php-cuong/docker-magento2-lamp.git
  • The following screen shows files downloaded successfully.

Git files downloaded successfully

Step 2: Downloading the required image from docker hub. 

To download images from a docker hub you need an account in docker hub and sign-in to docker application, we assume that you already have docker installed in your window machine or you can download the setup file by clicking here

  • To check docker version enter the below command in CMD 
Copy to Clipboard
  • The below screenshot shows the docker version 

Command to check Docker version

  • In step 1, we have already downloaded the docker files from Github, the below docker file that we are going to build a container for Magento installation.
    • “docker-compose .yml” file contains this code that images need to be installed.
      • You can also change the MySQL password
Copy to Clipboard
  • Navigate to the download git file folder by entering following command 
Copy to Clipboard
  • The following screen shows we have entered into docker folder. 

Changing File directory in CMD

  • Enter the below command to compose docker.  
Copy to Clipboard
  • The below screenshot shows files have been downloaded successfully.
    • It takes a minimum of 15 times to download file-based your internet speed. 

docker-compose

  • The below screenshot shows the docker container is up and running

Docker container with linked images from docker hub

Step 4: Download Magento files 

To download Magento files it is important to have login details of magento.com. Here we need to download the Magento as shown in the below screenshot select the version and click on download.

Downloading Magento installation files

Step 5: Magento installation Steps

  • In step 4 we have downloaded the setup file now we need to create a folder in a “sources”, 
    • Create a folder with “magento”

Creating a folder with name Source in the root directory

  • Now extract the files in the “magento” folder. 

Extracting Magento installation file from using win war

Create a database for Magento 

  • To create a database in MySQL enter the below URL in your browser  “127.0.1.1:8080″

PHPmyadmin login page

  • Enter the user name password. 
    • User Name: root
    • Password: giaphugroup
  • Once log-in to PHPMyAdmin, click on “new” and enter database name “magento2”, as shown in the screen below.

Creating a database form Magento2 in PHPmyadmin

  • Enter the local IP address “127.0.1.1”  in the browser and click on “Magento” as shown in below screenshot.

Index page of localhost

  • Once you click on the Magento it will redirect to the installation wizard as shown below screen. 
  • to install Magento in need to perform the following steps 
    • Readiness Check
    • Add a Database
    • Web Configuration
    • Customize Your Store
    • Create Admin Account
    • Install 

Magento 2 installation wizard

  • Click on the “Agree and Setup Magento” you will be navigated to the below screens, now click “Start readiness check” 

Readiness Check of Magento 2

  • As shown in the below screenshot “Readiness Check” is ok now click on “Next” button.

Readiness Check completed in Magento wizard

  • Now we need to add a database connection as shown below screen and enter required  detail and click on next
    • Database Server Host : MySQL 
    • Database Server Username: root
    • Database Server Password :***************
    • Database Name:magento2

Adding database connection to Magento

  • In this step, we need to add a “web configuration” details and click on the Next button. you want to change the log-in to admin URL, you can make changes here

Setup web configuration in Magento installation wizard

  • In this step, we need to select the time zone and currency and language as shown below screen. 

Selecting time zone and currency and language in Magento installation wizard

  •  In this step we need Create Admin Account as shown in the screen below, enter the required details username,email, password. 

Creating admin user in Magento

  • All steps are completed, now click on the “Install Now” button. 

Magento ready to install

  • The below screen shows the install process and it will take some time. 

Magento installation process

  • As shown in the screenshot below, the Magento installation is successful. 

Magento installation is successful

  • The following screen shows the admin log-in page.

Magento admin admin log-in page

  • The following screen shows the Magento administrator dashboard. 

Magento admin Dashboard

Hope this article help you set-up your Magento environment on your machine. 


Who are we

We are passionate about SAP consulting and executing SAP Integration projects. Reach out to us for a free assessment of your SAP needs.

Contact us for a free assessment