Thursday, February 24, 2022

Deploy a LAMP server using Docker-Compose

 in This Tutorial you will Learn " How To Deploy a LAMP server using Docker-Compose On Rocky Linux"

LAMP (Linux, Apache, MySQL, PHP/Perl/Python) is an acronym denoting one of the most common software stacks for many of the web's most popular applications.
Docker Compose is a tool that was developed to help define and share multi-container applications.
Docker is a software platform that allows you to build, test, and deploy applications quickly.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y ; docker-compose --version ; docker --version
mkdir -p test/DocumentRoot  ; cd test/
nano index.php
<?php
phpinfo();
?>

nano docker-compose.yml
version: '3'
services:
    php-apache:
        image: php:7.2.1-apache
        ports:
            - 80:80
        volumes:
            - ./DocumentRoot:/var/www/html:z
        links:
            - 'mariadb'

    mariadb:
        image: mariadb:10.1
        volumes:
            - mariadb:/var/lib/mysql
        environment:
            TZ: "Asia/Kolkata"
            MYSQL_ALLOW_EMPTY_PASSWORD: "no"
            MYSQL_ROOT_PASSWORD: "rootpwd"
            MYSQL_USER: 'testuser'
            MYSQL_PASSWORD: 'testpassword'
            MYSQL_DATABASE: 'testdb'

volumes:
    mariadb:
docker-compose up -d
mv index.php DocumentRoot/

sestatus ; hostname -f
http://192.168.1.60
_________________________________________________________________________________________

No comments:

Post a Comment