LAMP Architecture with Docker Compose

Sreedevi ValetiSreedevi Valeti
2 min read

Hello readers, in this article we are going to discuss about docker compose and building LAMP Architecture with Docker Compose.

What is Docker Compose

Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.

YAML File

YAML stands for YAML ain't markup language, which is a data serialization language that is often used for writing configuration files. YAML will store data in key value pairs, YAML file is a space indented.

Docker Compose Installation

To install docker compose on the Linux machine, please follow the steps below

  • Connect to your Linux Machine

  • Get root privilege's => sudo su -

  • Run the following commands

  • curl -SL https://github.com/docker/compose/releases/download/v2.11.1/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
    
  • ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
    
  • To verify docker-compose installation, run the following command

# docker compose --version

docker-compose.PNG

LAMP Architecture

LAMP stands for Linux, Apache, MySQL, and PHP. Together, they provide a proven set of software for delivering high-performance web applications.

LAMP Architecture on Docker.png

  • Create a docker compose file for setting up LAMP Architecture
# vim docker-compose.yml
---

version: '3'

services:
 mysql:
  image: mysql
  environment:
   MYSQL_ROOT_PASSWORD: sql
  networks:
    - host
 apache:
  image: tomee
  ports:
   - 80:8080
  networks:
    - host
  links:
   - mysql:apachesql
 php:
  image: php
  ports:
   - 8080:8080
  networks:
    - host
  links:
   - mysql:sqlphp
   - apache:phpapache

networks:
  host:
...
  • To run the docker-compose.yml file in a detached mode, run the following command
# docker-compose up -d
0
Subscribe to my newsletter

Read articles from Sreedevi Valeti directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sreedevi Valeti
Sreedevi Valeti

I am a Tech Enthusiastic, working as a Cloud Engineer. I have expertise in Cloud Administration. Tech Stack: Multi-Cloud: AWS and AZURE Programming Languages: Python Infrastructure As Code: Terraform and Cloud Formation DevOps Tools: Git, GitHub, Docker, Code pipeline, Code Build, Code Deploy, Code Commit. OS: Linux Certifications : AWS Certified Solutions Architect Associate, AZ-900 For technical collaborations, you can drop a mail to sreedevi.devopscloud@gmail.com