In this video, Wagento Commerce Technical Lead Joe Shelton explains how to use the new Magento Cloud Docker configuration to set up a local development environment. He describes the specific steps to take for a setup coinciding with a project already in progress.
Shelton begins by sharing the three essential assets you must download for the Docker environment setup: the project files, the database, and the media. With these key components downloaded, the next step is to prepare for the Docker configuration files by generating a Docker compose .yml file.
“[This is] the essential file responsible for defining which containers will be a part of the Docker environment,” Shelton explains. “the .yml ordinarily defines what services will be available in the cloud environment, and the Docker build tool ensures that those same services are available in your local environment.”
In the next part of the tutorial, Shelton explains how to customize the Docker configuration. The first step is to take a distributable file and create a customizable file as a template. Next, Shelton shares how to apply project-specific names, change the URL, and rename the volume that the project’s files sync to.
After the customization step, it’s time to set up the Docker environment. Shelton shares that this can be done with two simple commands.
“The first is docker sync,” Shelton explains, “which will perform the initial sync of project files from the host machine to the docker environment.”
After this, it’s necessary to examine the containers that belong to the environment.
At this point, Shelton says the process is nearly complete—all you may want to do is generate an env.php file to connect to your environment.
“Magento gives you a pretty easy way to do this,” Shelton says. “Just like the deployment process of a cloud environment, the env.php file will be regenerated with connection information for the services active in our local environment.”
In the final portion of the tutorial, Shelton reminds us to view the locally-running project website in a browser.
“Now that your docker environment is set up, you’ll want to continue using it for the days, weeks, or months to come while you build or maintain your website,” Shelton concludes. “The good news is none of the steps outlined in the video will need to be repeated.”