Installing Magento 2.4.4 with Docker Run on Linux/Windows

So earlier I had written a blog on installing Magento with docker-compose here. And here is one more way to do the installation. Now instead of using different containers for Apache, MySQL, and Elasticsearch. We are using a single container for all the servers. So I dug further and created a new container in the docker hub that is publicly available and can be used to install the Magento 2.4.4 version. It includes PHP 8.0, MariaDB 10.1, Elasticsearch 7.17.3. Here is the link for that

So below are the steps to install:-

  • Install docker on your system from here https://docs.docker.com/desktop/windows/install/
  • Download Magento from here https://magento.com/tech-resources/download on any folder of your Linux/Windows machine
  • Using the terminal/CMD tool go to that folder
  • Then if you are on Linux run the below command
    sudo docker run -p "80:80" -p "3306:3306" -p "9200:9200" -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql pravams/lamp
  • If you are on Windows you will have to use the absolute path below
    docker run -p "80:80" -p "3306:3306" -p "9200:9200" -v C:\Users\Prashant\code\docker\lamp\app:/app -v C:\Users\Prashant\code\docker\lamp\mysql:/var/lib/mysql pravams/lamp
  • If you are not getting any errors, you have successfully 1 container running with the full lamp stack needed to run Magento.
  • use docker ps -a to get the container id
  • Then use this command to log into the docker container
    docker exec -it containerid bash
  • After you are logged in you should see Apache, and MySQL running. If not use the below commands
    service apache2 start
    service mysql start
    service elasticsearch start
  • After that you can run the Magento install command below
    magento setup:install --base-url=http://localhost/ --db-host=localhost --db-name=magento --db-user=root --db-password= --admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-host=localhost --elasticsearch-port=9200
  • If you do not get any errors, Magento is almost installed. Next, we need to run the upgrade commands below
    php bin/magento setup:upgrade
    php bin/magento setup:di:compile
    php bin/magento cache:flush
    chmod 777 -R var pub generated
  • Magento should load up http://localhost URL on your system
  • If you get any errors like “Current version of RDBMS is not supported.”. This means we can either change the MySQL version. But I found another fix which was to edit app/etc/di.xml in the Magento code.
  • You can specify acceptable MariaDB versions here – currently 10.2-10.4. For example to allow MariaDB 10.5 ^10.[2-5].
<item name="MariaDB-(10.2-10.5)" xsi:type="string">^10\.[2-5]\.</item>

I do plan to create more such containers and will keep you updated on this blog 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.