LAMP Architecture with Docker Compose

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

Did you find this article valuable?

Support Sreedevi Valeti by becoming a sponsor. Any amount is appreciated!