Why waste time creating a local environment / local development environment (LDE) from scratch when a simple, effective software can do it for you? Docker removes the obstacles to digitally adapt to new technologies. It uses existing technologies to act as an assistant between different operating systems and developers.
One of the main benefits of a solution like Docker is that helps to free applications from system infrastructure, allowing expansion in capacity through collaboration. This article will also guide you in setting up Docker in order to start using it immediately and build a local environment (LDE).
What is Docker exactly?
To understand what it is, it’s best to first understand what it isn’t.
Many compare it to traditional virtualization, and in some ways it’s true. Traditionally, you start with hardware, example a server. Within this, you run an OS. Running on top of the OS is the Hypervisor, which runs multiple VMs (virtual machines). Each VM needs to include its own OS. This can bloat up the file size, and hence, the memory needed to run it.
The main advantage of Docker is the ability to use it to write code in a test environment and seamlessly transfer it to a staging or production machine. It doesn’t matter if the machines have a different operating system, as long as they all run Docker.
Another advantage, which is mostly felt in a larger scale production environment, is the software’s ability to share and use operating capacity effectively. As the workload increases, additional nodes can be added to increase the cluster memory. It doesn’t matter what operating systems each individual node has. Because as long as it has Docker installed, it’ll work together with the rest of the cluster.
What developers think about setting up a local environment with Docker
When developing new websites, work usually starts locally using programs like MAMP / XAMPP or VVV. But sometimes everything looks different on the server and things don’t work anymore. Bernhard, a PHP developer, focusing on plugins and WordPress, uses Docker to create a local environment that’s very close (or even exactly equivalent to) the server. And only in seconds, as opposed to many minutes.
- What are the benefits of a local environment?
- Why is Docker one of the best solutions?
- What is the challenge?
Here’s what Bernhard has to say.
Steps to Create an LDE – Local Development Environment
One of the greatest features of Docker is the ability to create a local development environment in less than half an hour. The following example will run on Zend Expressive, but it will also work on PHP based applications.
Step 1 – Install
It might seem obvious, but we thought we’d put this step in here anyway. You can install Docker for Linux, Mac, and Windows. Right from the installation setup, you’ll realize how simple this solution is. Docker also comes free with your Plesk panel.
Step 2 – Set up
There are two ways to go about setting up your environment: the manual and automatic methods. In the manual method, we start by creating three containers. We mimic the most basic PHP applications, which consist of a web server, PHP runtime, and a database server. Label each container to reflect these three components. So as not to keep things too generic, you may opt to label them by the actual name of the software. This method is best for developers who really enjoy coding the most.
For those who just want to get the job done, they should certainly go for the automated method. By using the Docker Compose tool, it creates the containers for you and you don’t have to go through the manual work.
Step 3 – Container Configuration
Add the necessary configuration code and relevant elements in each of the three containers. Carry out this step carefully as any errors or omissions here might negatively affect the end result.
Step 4 – Container Booting
The final step is to start using Docker in daemon mode. As long as you carried out the previous step properly, once you enter the command to run Docker, it’ll automatically build the containers and start operating in the proper mode. Once the containers are created, you can open a web browser or the WordPress site directly. And see your creation come to life.
How to make Docker even easier to use
Having multiple portals and systems running at the same time can be confusing and stressful for developers. In order to keep things simple and mistakes to a minimum, you need a central solution to create, monitor and run websites.
Enter Plesk, a one-stop solution for developers and admins. We also offer a ready-to-code environment which includes support for various languages. Being a hosting platform, there’s quite an extensive range of tools and toolkits, including security and backup. But we also provide a free Docker extension – and for $5 monthly, you’ll also get remote node support.
So you can manage Docker containers directly from Plesk’s interface. You get access to the image library, but can also upload your own images. When installing containers, you choose whether to do it on your local system or Plesk’s own remote node register.
Despite the advantages of using Docker on Plesk, you can only benefit from them if you install and set up the Docker extension. Once you do that, you have access and make use of a wide range of technologies, including MongodDB and Memcached. And if you need any node support along the way, we offer a convenient premium support package too!