Dockerized Magento 2.4.4 in 4 Steps

by | July 29, 2022 | Blog

We’ll be providing handy tips, tricks, and integrations for Magento now and then in this blog and it’s nice to have a clean, no-risk local environment where you can experiment risk free with something easy to toss and replace. Here’s a quick guide to setting one up in under 20 minutes (depending on your download speeds).

What you’ll have at the end:

  • A containerized system running Magento 2.4.4 that you can start and stop as you need.

What you’ll need to get started:

  • Docker Desktop or the Docker CLI with docker-compose.
  • Docker Desktop on Mac M1 threw an error on the first try because too little memory was allocated. In Docker Desktop, go into the settings, select the Resources tab, and allocate 6 GB. You’ll need to restart Docker to make it work.
  • Git
  • Curl
  • Your Magento access keys (pull them up in a browser window before starting this)

The installation of the first three will depend on your system.

Step 1:

Create a directory where your docker files will live. Open a terminal and CD into it.

Step 2:

We’ll use Mark Shust’s handy-dandy installer. In the terminal, enter the following and hit enter.

curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup | bash -s -- magento.test 2.4.4

During the process it may ask you to enter your system credentials to approve an elevation to create an entry in your hosts file and install a Root Certificate Authority (Root CA) to prevent your browser from issuing scary warnings when you try to access the site.

It will also ask for your Magento Access Keys (see above) from the Magento Marketplace so it can download the latest version of Magento itself.

At this point, Magento will be up and running. But there are more steps to fully “enjoy” it.

Step 3:

Because this runs in development mode, the emails you’ll need to establish two-factor authorization for the administrative login will not get sent. In the terminal, enter:

bin/magento module:disable Magento_TwoFactorAuth

Now you can go to to https://magento.test/admin and login with: john.smith/password123

It is highly advisable you create a new admin login and delete this one.

Step 4: (optional)

What’s a store without products? To import the sample data, run these commands in the terminal you opened for the installation. The setup process installs a bin directory with helper functions so you can send commands into the containers without having to know the Docker commands to do so.

Run:

bin/magento sampledata:deploy

This will take a while. When it completes, run:

bin/magento setup:upgrade

Closing thoughts

To shut down the virtualized system of containers, in your install directory, run:

bin/stop

To start them again, in the same directory:

bin/start

Thanks for reading. We’ll use this setup again, so follow us on LinkedIn as we will post when new blogs come out, or subscribe in the form in our blog sidebar.

GREG BULMASH

Greg started blogging in the mid-90s before "blog" was a word. While an editor at IMDb, he updated his 80s BASIC programming skills to add PHP and JavaScript. Since then he's picked up stints with Microsoft and Amazon. He's spoken at tech events, and put together 150+ free tech education events for kids.

Popular Posts

Blog Subscription

Follow Us