Skip to content

๐Ÿš€ Ready to go, Docker based LAMPP environment

Notifications You must be signed in to change notification settings

theqdev/docker-lampp-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Docker based LAMPP environment

This is a docker based LAMPP like environment, based on 3 containers:

  • web-server (CentOS 7, Apache 2.4, PHP 7.2)
  • mysql-server (MariaDB 10.5.9)
  • pma-server (phpMyAdmin 5.0.1)

Installation

git clone https://github.com/theqdev/docker-lampp-env.git 
cd docker-lampp-env
docker-compose up -d

Running your code

Place your code under html directory. The web server is available at http:https://localhost:8080. You can access your web-server by SSH-ing into it using the following command:

docker exec -it web-server /bin/bash SSH into container

Managing your database

The PMA container can be accessed at http:https://localhost:5000. For larger imports you can place your mysql export files in the mysql directory then import using something like this:

docker exec -it mysql-server /bin/bash SSH into container
cd /home/mysql
mysql -u root -p my_database < DatabaseBackup.sql

You can find the default mysql credentials below:

mysql_host:mysql-server
mysql_user:root
mysql_pass:secret
Other useful commands:
  • docker ps List containers and their state
  • docker logs -f web-server Get container logs
  • docker ps -a -q | ForEach { docker stop $_ } Stop all containers
  • docker exec -it web-server /bin/bash SSH into container
  • docker rm -f $(docker ps -aq) Remove all containers
  • docker-compose up -d --build Rebuild containers in the background

Note* If ran on Windows, try to make sure you run both your docker instance + terminal as administrator, to avoid any weird issues.