Join us at GITEX 2025! Discover our solutions at Hall 4, Booth H-30 Schedule a Meeting Today.
Automate Marketing Initiatives with Salesforce Marketing Cloud Learn More
Join us at GITEX 2024! Discover our solutions at Hall 4, Booth H-30 Book your live demo today.

How to remove machine dependency for LAMP development using Docker?

Being a developer, sooner or later you have to undergo such machine dependency problems while deployment of code on the server. There are scenarios where you have to work with a team of developers and maybe they use different versions of PHP and MySQL, or if you are working for LAMP environment then WAMP, XAMPP, LAMPP, MAMP installation can be a big pain for developers.

 

Now, let’s assume you are done with all installation but what will happen if the server environment does not match with your local development environment? I know this is the most undesirable situation for any developer. But, do you know you can get rid of all these hitches and save your development time? There are a number of solutions available in the market. But, here I want to share my personal experience with Docker.

 

My experience with Docker has been quite good, I have been using Docker for 3 years now. Docker, which initially released 5 years back has filled the gap and offered a consistent development environment to the developers. Before using docker, as a full stack developer, while working on LAMP environment, I always had to switch my PHP, Apache, MySQL settings and versions, when I switched to multiple projects. It was a big pain to repeat the set every time and it ultimately affected my productivity. But, Docker has made things easier and faster.

 

Let me explain you with an example:

If I want to set up my development environment for PHP 7.2, Mysql mysql:5.7.22 and Nginx server.

I have multiple solutions to setup this environment:

  • First, I can install XAMPP/WAMP/LAMPP, but this environment does not contain Nginx service.
  • Second, I can install everything separately in the local machine, but there are many problems with this process too.

Problem 1

If your development machine is Windows and deployment server is Ubuntu or vice-versa.

Problem 2

Development software compatibility installation is a critical time consuming process for the developer.

Problem 3

Even if you solve both of these problems, you will have to change settings according to your project’s requirements and it will take a long time to execute those changes.

That’s where Docker comes to the rescue, it not only simplifies all these problems but simply removes all machine dependency problems.

How to install Docker?

Using Docker does not require any professional courses or training. If you have a basic understanding of development environment setup, you can easily do it . You just have to install Docker in your machine or on the server and simply let it manage everything right from the development to the deployment. With Docker, you can create any number of virtual machines and keep those into a single container.

You can find a complete Docker installation guide here with this link https://docs.docker.com/install/ from where you can select your OS and install. Docker uses the concept of container and images. Now let’s understand what is Docker’s container and images.

Docker Images, Layers and Containers

Docker images are basically the files with the set of instructions, consisting of multiple layers that can be used to incorporate tools, system library and other files required for executable code. When we run an image, it becomes one or multiple instances for the container. The Docker image includes all dependencies of the executable code so that the containers can run independently from one environment to another in a similar OS without any changes. You can have multiple containers for a single image.

  • If you want to see the list of all running Docker containers you have to execute the command
    docker ps-a
  • If you want to see all running images you have to execute the command
    docker images –a

You must have basic knowledge of command execution as Windows operating system uses power shell to execute the commands and Ubuntu and Mac OS use the terminal to execute the commands.

How to set up XAMPP machine using Docker?

Before setting up XAMPP machine, make sure you already have Docker installed in your machine.

Now first create a directory anywhere in your system.

 

Directory structure (I have created this directory according to my requirements, you can create according to your requirement):

 

  • mysql (directory)
  • nginx (directory)
  • php (directory)
  • docker-compose.yml file)
  • Dockerfile (file and it does not contain file extension)

What is docker-compose.yml ?

 

Compose is a tool for defining and running multiple-container Docker applications. With Compose, you can use a YML file to configure your application’s services. Define the services that make up your app in docker-compose.yml, so they can be run together in an isolated environment.

 

What is Dockerfile?

 

A Dockerfile is a text document that contains all the commands a user can call on the command line to assemble an image.

Using docker build, users can create an automated build that executes several command-line instructions in succession. Following are the commands that you can use in a Dockerfile.

  • Mysql directory: Put your customized MySQL conf file if you have customized anything.
  • nginx directory: Put your customized nginx conf file if you have customized anything.
  • PHP directory: Put your custom php.ini file if you have customized anything.

Note:

Make sure the path of above-mentioned files are currently written in docker-compose.yml

You can navigate here <ahref=”https: github.com=”” osingh152=”” docker-with-php-mysql-nginx”=””>https://github.com/osingh152/docker-with-php-mysql-nginx and find the sample files for docker-compose.yml and Dockerfile</ahref=”https:>

A place for big ideas.

Reimagine organizational performance while delivering a delightful experience through optimized operations.

How to PHP application using Docker in Laravel?

Let’s explore how we can use Docker container with php 7.2. , MySql 5.* and NGINX server. Change nginx file for laravel public folder. The path for Laravel: root /var/www/public;

 

Other: root /var/www;

 

/var/www -> This is a Path of the working directory

 

Before moving to the next step please make sure you have installed Docker in your machine

Command to check Docker Version-docker –v

 

Please follow the below mentioned steps and commands to use docker

  • First, you have to clone the project in your specific drive or directory
  • Now Install docker and docker compose in your machine
  • Open power shell
  • Navigate to your project directory, refer step 1.
  • docker-compose up -d
Essential Docker Commands

 

1. Start all required containers:docker-compose up -d

-d: Run the container in the background

2. Stop all container:docker-compose down

3. Run commands in a specific container:docker-compose exec app nano .env

docker-compose exec – This is a command to execute commands

app – This the name of the container in which we want to run the command

4. Accessing MySql:docker-compose exec db bash

After entering db bash hit mysql -u root -p for MySQL root password and default database refer docker-compose.yml file

Hope this article will help you to have the basic understanding and usability of the Docker and provide you with a solution for machine dependency problem while development to save your time and increase your productivity.

Top Stories

Odoo ERP Implementation (1)
How Indian MSMEs Can Use Budget 2026 Subsidies to Fund Their Odoo ERP Implementation
India’s Union Budget 2026–27 has sent a strong signal to small and medium enterprises: technology adoption is no longer optional — it is strategic. With a ₹10,000 crore MSME-focused fund, a ₹2,000 crore top-up for the Self-Reliant India Fund, and renewed emphasis on digital modernization, the government is actively encouraging
Sap’s critical 9.9 vulnerability
SAP’s Critical 9.9 Vulnerability: Why Mid-Market Companies Are Rethinking Their ERP Security
Resource Planning (ERP) systems sit at the center of business operations. When a vulnerability with a CVSS score of 9.9 is disclosed in SAP environments, it immediately draws attention — not because of hype, but because of operational risk. During the February 2026 SAP Security Patch Day, multiple high-severity security notes were released, including one
Odoo
Odoo v14 End of Life: What the October 2026 Kill Date Means for Your Business
If you’re still running your business on Odoo v14, you now have a hard stop on the calendar 31 October 2026. That’s when Odoo v14 will reach the end of life on Odoo.sh, and any database still on that version will be blocked from normal use. It’s not just a technical detail it’s a real business continuity risk if you ignore
10 Proven Tips for Successful Odoo Module Customization
10 Proven Tips for Successful Odoo Module Customization
Odoo is famous for its customizable nature. Businesses from around the world choose Odoo because of its scalability and modality. Regardless of the business size, Odoo can cater to the unique and diverse needs of any company. Odoo has proven its capacity and robust quality in terms of helping businesses
How Odoo is Transforming Traditional Education with E Learning
How Odoo is Transforming Traditional Education with E-Learning?
Does your school need to centralize data to easily access and share information between applications? Odoo provides an ERP system that can do so. Using multiple software applications for every department can be dragging. With Odoo, you can systematize your operations for efficiency, user-friendly navigation, uniform cross-functional practice, and increased
How Can Odoo Module Customization Revolutionize Your Purchase Management Workflow
How Can Odoo Module Customization Revolutionize Your Purchase Management Workflow?
Odoo ERP’s modules are engineered with a robust structure to drive efficiency across your entire organization. Each module is specifically designed to address distinct business functions, from finance and inventory to sales, marketing, and purchase management. This tailored approach ensures that every part of your company has the tools it needs to excel. The true power of

          Success!!

          Keep an eye on your inbox for the PDF, it's on its way!

          If you don't see it in your inbox, don't forget to give your junk folder a quick peek. Just in case.



              You have successfully subscribed to the newsletter

              There was an error while trying to send your request. Please try again.

              Zehntech will use the information you provide on this form to be in touch with you and to provide updates and marketing.