Jump Directly To
Docker can be used to install LAMP stack on any platform in just few simple steps. Docker is easy to install and manage and this gives full control on the configurations of your environment. Along with this, docker also ensures that your application runs perfectly fine after deployment across platforms.
Check if the docker is installed or not?
First step is to check if docker is installed on your computer or not. If it is not installed, it should be installed first before moving to next step. Docker comes in many flavors and it can be installed on any platform be it Windows , Linux or Mac. So far so good but How to check if docker is installed or not? It’s easy, open the terminal of your machine and just run the below command in the terminal.
docker info
If docker is installed, the result shows docker version and other information something like below screenshot.
Now that you have docker installed on your machine, installing LAMP stack is just a matter of running few commands mentioned below. If you don’t understand the command, don’t worry i am going to explain each command step by step:
git clone https://github.com/webmidas/docker-lamp.git cd docker-lamp/ cp sample.env .env // modify sample.env as needed docker-compose up -d // visit localhost
Download LAMP stack from github
Lets start with the first step. Visit this website link to download docker lamp package on your machine. Extract the files to the folder of your choice. Let’s name the folder for example docker-lamp . Go to docker-lamp folder and look for the file sample.env. Rename that file from sample.env to .env and do the configurations as per your need. Sample file already contains pre-configured values. In case you need customization, you can change it as per requirement. Details about configuration values can be obtained from this link.
Open powershell and run the command
Once this is done, open the terminal to run below command to start the containers for LAMP stack. if everything is fine, you will see the success message similar to one shared below.
docker-compose up -d
You can now access the server by typing localhost in your browser. Try docker for your new LAMP stack and enjoy the ride. If you have any question, feel free to comment them below: