Docker Ubuntu LAMP Setup on Windows

MY LAMP SETUP

Pull Ubuntu

docker pull ubuntu:latest

Pull Mariadb

docker pull mariadb:latest

Create the shared network

docker network create –driver=bridge lampstack

Create MariaDB Container

docker run -itd -p 33063:3306 –name=lampmys…


This content originally appeared on DEV Community and was authored by vkuberan@gmail.com

MY LAMP SETUP

  • Pull Ubuntu

    docker pull ubuntu:latest

  • Pull Mariadb

    docker pull mariadb:latest

  • Create the shared network

    docker network create --driver=bridge lampstack

  • Create MariaDB Container

docker run -itd -p 33063:3306 --name=lampmysql --network=lampstack --env MARIADB_USER=root --env MARIADB_PASSWORD=google --env MARIADB_ROOT_PASSWORD=google mariadb:latest

  • Create Ubuntu Container

    Replace "N:\dockercompose\lamp\src" with your working directory path.

    docker run -itd -p 8080:80 --user root --name=lampstack --network=lampstack -v N:\dockercompose\lamp\src:/var/www/html/ ubuntu:22.04 /bin/bash

  • Get in to the Ubuntu Container

docker attach lampstack

  • Install all necessary Apache/PHP packages

    Refer 1: Ubuntu - Install LAMP Stack

    Execute the following commands one by one.

    apt-get update

    apt-get upgrade

    apt-get install iputils-ping

    apt-get install vim

    apt-get install systemctl

    apt-get install apache2 apache2-utils

    systemctl enable apache2

    systemctl start apache2

    systemctl status apache2

    apt-get install mariadb-client

    apt-get install php libapache2-mod-php php-mysql php-curl php-gd php-mbstring php-xml php-soap php-intl php-zip

    systemctl restart apache2

  • Rewrite Mode
    If you want seo like links, You need to do some additional work

    Refer 1: Ubuntu - Enable Mod Rewrite

    Refer 2: Ubuntu - Enable Mod Rewrite

    cd /etc/apache2/sites-available/
    vi default.conf or vi 000-default.conf
    

    Add following section to the one of the above mentionted file.

    <Directory /var/www/html>
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted
    </Directory>
    

    Enable mod rewrite and restart apache

    a2enmod rewrite 
    systemctl apache2 restart
    

Additional configuration

  • Install phpMyAdmin

docker pull phpmyadmin/phpmyadmin

  • Create container for phpMyAdmin

docker run -itd -p 2599:80 --name=lampphpmyadmin -e PMA_ARBITRARY=1 --network=lampstack phpmyadmin/phpmyadmin


This content originally appeared on DEV Community and was authored by vkuberan@gmail.com


Print Share Comment Cite Upload Translate Updates
APA

vkuberan@gmail.com | Sciencx (2021-12-09T08:49:00+00:00) Docker Ubuntu LAMP Setup on Windows. Retrieved from https://www.scien.cx/2021/12/09/docker-ubuntu-lamp-setup-on-windows/

MLA
" » Docker Ubuntu LAMP Setup on Windows." vkuberan@gmail.com | Sciencx - Thursday December 9, 2021, https://www.scien.cx/2021/12/09/docker-ubuntu-lamp-setup-on-windows/
HARVARD
vkuberan@gmail.com | Sciencx Thursday December 9, 2021 » Docker Ubuntu LAMP Setup on Windows., viewed ,<https://www.scien.cx/2021/12/09/docker-ubuntu-lamp-setup-on-windows/>
VANCOUVER
vkuberan@gmail.com | Sciencx - » Docker Ubuntu LAMP Setup on Windows. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/12/09/docker-ubuntu-lamp-setup-on-windows/
CHICAGO
" » Docker Ubuntu LAMP Setup on Windows." vkuberan@gmail.com | Sciencx - Accessed . https://www.scien.cx/2021/12/09/docker-ubuntu-lamp-setup-on-windows/
IEEE
" » Docker Ubuntu LAMP Setup on Windows." vkuberan@gmail.com | Sciencx [Online]. Available: https://www.scien.cx/2021/12/09/docker-ubuntu-lamp-setup-on-windows/. [Accessed: ]
rf:citation
» Docker Ubuntu LAMP Setup on Windows | vkuberan@gmail.com | Sciencx | https://www.scien.cx/2021/12/09/docker-ubuntu-lamp-setup-on-windows/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.