Would you like to learn how to install Magento using Docker on Ubuntu Linux? In this tutorial, we are going to show you all the steps required to perform the Magento installation using Docker on a computer running Ubuntu Linux in 5 minutes or less.

• Ubuntu 20.04
• Ubuntu 18.04
• Ubuntu 19.04
• Magento 2.4
• MySQL 5.7
• Elasticsearch 7.6.2

Tutorial Magento – Docker Installation

Install the Docker service.

Copy to Clipboard

Create a Docker network.

Copy to Clipboard

Download the MySQL docker image from the online repository.

Copy to Clipboard

Download the Elasticsearch docker image from the online repository.

Copy to Clipboard

Download the Magento docker image from the online repository.

Copy to Clipboard

List the Docker images installed on your system.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Create a docker volume to store the MySQL persistent data.

Copy to Clipboard

Verify the persistent data directory.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Optionally, create a symbolic link to an easier access location.

Copy to Clipboard

Start a MySQL container with persistent data storage.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

In our example, the MySQL image was used to start a new container.

The new container has persistent data storage.

The container ID is 2df3ce59a3d8e52723554258d2781da37223249848064b0cadb1c80e57d0d1d0.

The database ROOT account password configured was kamisama123.

A database named Magento was created.

A database account named Magento was created and the password kamisama123 was configured.

Create a docker volume to store the Elasticsearch persistent data.

Copy to Clipboard

Verify the persistent data directory.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Optionally, create a symbolic link to an easier access location.

Copy to Clipboard

Start an Elasticsearch container with persistent data storage.

Copy to Clipboard

Create a docker volume to store Magento’s persistent data.

Copy to Clipboard

Verify the persistent data directory.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Optionally, create a symbolic link to an easier access location.

Copy to Clipboard

Start a Magento container with persistent data storage.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

In our example, the Magento image was used to start a new container.

The new container has persistent data storage.

The container ID is a40aa57dc686055572f994cda2a3edb56c404899c82bea50e5486b927867d24e.

It may take up to 25 minutes for Magento to finish the installation process.

Tutorial Docker – Magento installation

Open your browser and enter the IP address of your web server plus /ADMIN.

In our example, the following URL was entered in the Browser:

• http://192.168.100.10/admin

The Magento login interface should be presented.

Magento login

On the prompt screen, enter the following information.

• Username: user
• Password: bitnami1

After a successful login, the Magento dashboard will be displayed.

Magento Dashboard

Congratulations! You have finished the Magento Docker installation.

Tutorial Magento – Docker container management

Verify the status of all Docker containers using the following command:

Copy to Clipboard

Verify the status of a container.

Copy to Clipboard

To stop a container, use the following command:

Copy to Clipboard

To start a container, use the following command:

Copy to Clipboard

To restart a container, use the following command:

Copy to Clipboard

In case of error, use the following command to verify the container logs.

Copy to Clipboard

In our examples, we demonstrated how to manage Magento containers.