Community Blog Build an E-commerce Website Using Magento and Docker on Alibaba Cloud Starter Package

Build an E-commerce Website Using Magento and Docker on Alibaba Cloud Starter Package

This tutorial shows you how to set up your Magento e-commerce website using Docker with Alibaba Cloud's Starter Package service.

By Bineli Manga, Alibaba Cloud Community Blog Author.

The rapid evolution of internet technologies empowers the scores of companies to take their business online. Moreover, the rising adoption of Cloud technologies in modern enterprises enables them to minimize the costs of procuring and managing IT systems. Therefore, organizations striving to meet their growth objectives can leverage the twofold benefits of cloud computing services and e-commerce platforms. This tutorial demonstrates how you can build your own e-commerce website using the Alibaba Cloud platform.

To make it more easy and cost-efficient for startups and small-and-medium businesses (SMBs) to kickstart their online businesses, Alibaba Cloud is relaunching its Starter Package Program with several affordable plans that cost you significantly less compared to Amazon AWS, Microsoft Azure and Google GCP.

1. Why Build Your e-Commerce Website on Alibaba Cloud

Building your e-commerce platform on Alibaba Cloud offers the following advantages:

  • Alibaba Cloud supports world's #1 e-commerce website, Alibaba.com, which serves millions of customers on a daily basis.
  • It is a premier cloud service with 61 availability zones in 200+ countries and regions globally. This implies that with Alibaba Cloud, you deliver the data requested by your customers from the nearest available point to eliminate latency challenges.
  • Alibaba Cloud supports several international certifications pertaining to Datacenters around the world, such as CSA-STAR, SOC, PCI/DSS, GDPR. Such certifications assure that the data processed on Alibaba Cloud will always be secured by modern tools to meet the compliance requirements of international standards for data security.
  • Alibaba Cloud partnered with many globally recognized enterprises such as Air Asia, Ford, and many more to deliver superior services for their clients.

2. Setup the Environment

To build your e-commerce website, you should meet the following requirements:

  • Alibaba Cloud account. In case you don't already have one, set up an account before continuing
  • Computer with internet access
  • Basic knowledge of Docker and Docker Compose
  • A virtual machine running on Ubuntu OS 16 or higher

3. Alibaba Cloud Starter Package 2.0

Alibaba Cloud's Starter Package helps you get started instantly through simple, scalable, and cost-effective Elastic Compute Service (ECS) that caters to all your cloud hosting needs. The new SSD Cloud Server Packages provide easy-to-use, high-performance virtual machines with higher data transfer plans at hugely discounted rates for enabling you to start from as low as $2.50 a month. Since it is available across 14 global regions, you can easily choose the Datacenter Region for your servers to meet any specific requirements. It allows each user to have up to five ECS instances with the simultaneous Data Transfer Plans.

4. Case Study: How to Build Your e-Commerce Website Using Starter Package

4.1. Project Overview

To help you understand the process better, this tutorial demonstrates a scenario where an e-commerce website is built using the Magento framework, Docker, Docker Compose and Alibaba Cloud Starter Package.

Magento is an open-source e-commerce platform written in PHP. It includes transaction options, multi-store functionality, loyalty programs, product categorization and shopper filtering, promotion rules, and more. Installing Magento without using Docker can be very complex, and will take a lot of time to complete as it requires multiple configurations. Docker eases a developer's life by enabling technology to get up and running in a very short time. For scalability purposes, you can run many containers at the same time, therefore Docker Compose helps with the process of running several containers simultaneously.

4.2. Get the Starter Package

To implement the project mentioned in the previous section, you can use the Starter Package with the following options:

  • 1 Core CPU
  • 1 GB RAM
  • 25 GB SSD
  • 2 TB Data Transfer

To choose the plan with the above-listed specifications, you have to follow the steps listed below:

Step 1. Log in with your Alibaba Account

Go to Alibaba Cloud's Website Homepage, and click on Login at the top right corner of the screen. on the next page, enter your account credentials - email address and password.

Step 2. Buy Alibaba Cloud Starter Package Instance

Once you are logged in, choose the Starter Package option from the following screen:


Step 2a. After selecting the Starter Package bundle, proceed to buy the package by clicking on Buy Now in the bottom left corner of your screen, as shown below:


Step 2b. Now, you have to confirm the order by clicking on Place Order as shown below:



Step 2c. On the next screen, confirm your order and make the payment by clicking on Pay as shown below:



Once the payment transaction is processed, you will see a popup screen with a congratulations message.


Now you will be able to run an instance you just bought to build, deploy and manage your applications or avail the services included in the plan.

Step 3. Create and Select an Instance

After purchasing the Starter Package Elastic Computing Service (ECS) instance, you need to create and run an instance inside which you can run your Magento application in a containerized environment.

To do that, you have to go to your Billing Management section and see your Orders to check whether your ECS instance is running. You can click on the Manage link to get detailed information about your virtual machines such as Public IP address from which you can connect to via VNC or any SSH Client. The IP for this project's instance is


Step 4. Connect to Your Instance

After obtaining the IP address of your VM, connect back to your VM via SSH. Here, it is implemented with the help of a software called Putty. Below is the logon screen of Putty for quick reference:


After a successful configuration to the remote VM via SSH, you will see the following screen and will be able to run all the commands necessary to run Magento CMS in your VM.


4.3. Installing and Deploying Magento

Step 1. Install Docker and Docker Compose

Installing Docker Compose is quite simple. First, you have to run the following command to get the packages from Docker's GitHub repository.

Step 1a. Install Docker

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - 
$ echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" | sudo tee -a /etc/apt/sources.list.d/docker.list 
$ apt-get update 
$ apt-get install docker-ce -y

Step 1b. Install Docker Compose

To download and install Docker Compose's package, you have to run the following command:

$ sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose


Next, you have to install set /usr/local/bin/docker-compose as an executable file, by running the following command:


To check whether the installation was successful, you can run the command: $ docker-compose --version. This will display the installed version.


Step 2. Run Magento in a Containerized Environment

Instead of creating the YAML file by yourself, you can clone the one provided by Bitnami which can be found on Dockerhub by using the following command:

$ curl -sSL https://raw.githubusercontent.com/bitnami/bitnami-docker-magento/master/docker-compose.yml > docker-compose.yml


You can simply use the command below to run the images pulled from the .yml file.

$ docker-compose up -d



  • Since the above command runs in detached mode, you can still use the terminal window while the command runs in the background.
  • In case, you want to stop the containers, simply use the docker-compose down command.
  • By running the docker ps command on the terminal, you can get a list of all the containers on the system.



  • The above screenshot shows that to run Magento in a containerized environment, bitnami/magento and bitnami/mariadb need to run on two containers.
  • Also, the Magento server is running on ports 80 (http) and 443 (https) of the server. Hence, these ports (which are closed by default) need to be open on the VM to enable access to your application via the webserver.

Open Ports 80 and 443

By default, ports 80 and 443 are disabled for security reasons. To open these ports, you have to clone the configuration of port 22 on the default security group, with priority 1 as illustrated in the following screen:


Now, containers are up and running and the ports 80 (http) and 443 (https) are open. This implies that you can now open your browser and visit and see the page below:


After successful launching the app, the following page should appear:


You may now want to visit the admin page of Magento so as to set up your own store. So, all you have to do is visit and use the following credentials to log in.

Username: user
Password: bitnami1


Once you are logged in, you can access the Magento admin dashboard.


N.B: You should notice that the IP address is the public IP of the instance, and this is specific to the instance just bought for this project. Therefore, it will be different for the instance you will purchase.

5. Where to Go Next

There are many possible optimization options available, such as:

  • Adding a load balancer to a website to easily handle traffic spikes
  • Deploying a website in more than two availability zones


If you have followed all the steps outlined in this tutorial, then by now you understand how to install Docker Compose on your system, how to run multiple containers using Docker Compose and successfully install Magento CMS in a containerized environment.

0 0 0
Share on

Alibaba Clouder

2,600 posts | 750 followers

You may also like