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 direct printing workflow showing one click printing without PDF download or printer selection (1)
The Hidden Cost of Printing from Odoo — And How to Fix It
Every invoice, picking slip and delivery order printed from Odoo goes through the same cycle: click print, wait for the PDF to download, open the file, go to File → Print, select the correct printer, click print again. Six steps. Every document. Every day. For a single team member printing
Appointment Booking
How to Set Up Appointment Booking in Odoo — Complete Setup Guide
Setting up online appointment booking in Odoo does not require a developer or a third-party scheduling tool. The Zehntech Odoo Appointment Booking app gives you a live 24/7 booking page, real-time calendar sync, and automated confirmations — all inside your existing Odoo instance.This guide is for business owners, Odoo administrators,
Advanced Gantt Scheduling in Odoo
How to Set Up Advanced Gantt Scheduling in Odoo — Complete Guide
Advanced project scheduling inside Odoo does not require exporting to MS Project or maintaining a separate timeline tool. The Zehntech Odoo Advanced Gantt App for Project adds dependency types, automatic cascade, critical path visualization, resource workload management and baseline tracking to your existing Odoo projects — in under 10 minutes.
ai automation for small business
How Small Businesses Can Use AI Automation to Save 10+ Hours a Week without Coding
AI automation for small businesses is simpler than most owners expect. The tools exist, they are affordable, and none of them require coding. What most businesses lack is not access — it is a clear starting point. This guide provides that. It covers which tasks to automate first, which no-code
Odoo Tansforming business oprations
How Odoo is Transforming Business Operations in 2026 And Why Companies Are Switching Fast
In 2026, businesses are under constant pressure to do more with less—reduce costs, improve efficiency, and scale faster than ever before. Yet, many companies are still stuck with disconnected systems, manual processes, and outdated ERP solutions. This is exactly why Odoo ERP for business operations is gaining massive traction. Companies
Step-by-step guide to setting up Manufacturing Gantt Scheduling in Odoo — Zehntech
How to Set Up Manufacturing Gantt Scheduling in Odoo — Step-by-Step
Manual exports can work — for very small teams with low-frequency reporting needs. If your team reports monthly, uses a single Odoo module, and has an analyst with spare time, a manual export process is adequate. But for most Odoo teams reporting weekly or more frequently, there is a measurable

          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.