{"id":23462014,"url":"https://github.com/cslant/lamp-docker","last_synced_at":"2025-08-26T19:30:38.930Z","repository":{"id":104273121,"uuid":"467397076","full_name":"cslant/lamp-docker","owner":"cslant","description":":whale: This is a simple Docker Compose workflow that sets up a LAMP network of containers for local development. This also allows customizing the optional PHP version :elephant:","archived":true,"fork":false,"pushed_at":"2023-07-23T03:45:49.000Z","size":119,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T20:41:20.135Z","etag":null,"topics":["apache2","docker","docker-apache","docker-compose","docker-container","lamp","lamp-deployer","lamp-development","lamp-docker","lamp-environment","lamp-server","lamp-setup","lamp-stack","lampstack","lbiltech","mariadb","multi-docker","php","tanhongit"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cslant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-03-08T06:52:53.000Z","updated_at":"2025-02-22T12:49:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"906f36df-2a72-4985-b640-43011c5c739f","html_url":"https://github.com/cslant/lamp-docker","commit_stats":null,"previous_names":["cslant/lamp-docker","lbiltech/lamp-docker"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/cslant/lamp-docker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cslant%2Flamp-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cslant%2Flamp-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cslant%2Flamp-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cslant%2Flamp-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cslant","download_url":"https://codeload.github.com/cslant/lamp-docker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cslant%2Flamp-docker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272249230,"owners_count":24899955,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-26T02:00:07.904Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache2","docker","docker-apache","docker-compose","docker-container","lamp","lamp-deployer","lamp-development","lamp-docker","lamp-environment","lamp-server","lamp-setup","lamp-stack","lampstack","lbiltech","mariadb","multi-docker","php","tanhongit"],"created_at":"2024-12-24T08:15:28.405Z","updated_at":"2025-08-26T19:30:38.641Z","avatar_url":"https://github.com/cslant.png","language":"PHP","readme":"# Welcome to Local Docker Config for LAMP Stack\n\n:whale: This is a simple Docker Compose workflow that sets up a LAMP network of containers for local development. This also allows customizing the optional PHP version :elephant:\n\nThis configuration can be used for any PHP project (Laravel, Yii, CodeIgniter, Pure PHP, etc.) :tada:\n\n[![Docker](https://github.com/lbiltech/lamp-docker/actions/workflows/docker-image.yml/badge.svg)](https://hub.docker.com/r/lbiltech/lamp)\n\n## Table of Contents\n\n - [Configuration requirements](#configuration-requirements)\n - [Add your custom bash script to run docker](#add-your-custom-bash-script-to-run-docker)\n - [Installation and Setup](#installation-and-setup)\n - [Check the network ID and connect Database](#check-the-network-id-and-connect-database)\n\n\u003e Other docker configs: [LEMP Stack (Nginx, PHP, MariaDB, Redis)](https://github.com/tanhongit/lemp-docker.git) :whale:\n\n\n## Add your custom bash script to run the docker\n\n\u003e **Because maybe my configuration is not enough for the configuration required by your project or purpose, you need to add more configuration to the docker.**\n\nWith nature of allowing you to customize the PHP version according to your. We should also allow custom bash scripts to run when starting the docker.\n\nSo, you can add your custom bash script to run docker in the file **_docker/bash/custom.sh_** with the following steps:\n\n### 1. Create a file **_docker/bash/custom.sh_**:\n\nRun:\n\n```bash\ncd docker/bash\ncp custom.sh.example custom.sh\n```\n\n### 2. Add your custom bash script to run the docker\n\nThen, you can add your custom bash script to run docker in the file **_docker/bash/custom.sh_**.\n\nFor example, you want to install **_ngrok_** extension for your docker container:\n\n```bash\n#!/bin/bash\n\n# Install ngrok\nsnap install ngrok\n\n# Install ngrok for php\ndocker-php-ext-install ngrok\n\n# You can install other extensions here\n# docker-php-ext-install \u003cextension_name\u003e\n\n# etc.\nnpm install -g localtunnel\n```\n\nAnd now, just follow the steps below and run the docker.\n\n## Configuration requirements\n\nTo use the optional PHP image, you need an additional web server, such as Apache, that can proxy HTTP-request to the Apache-pot of the container. This is not a requirement for the fpm image but is for the web server.\n\n - **Multi-site integration**\n - **PHP optional version with custom in .env file** (example: 7.4, 8.0, 8.1, 8.2, etc.)\n - Web server: **Apache**\n - DBMS (database management system): **Mariadb**\n - In-memory database: **Redis**\n - SSL Certificate (using **mkcert**)\n \n## Installation and Setup\n\n\u003e **Warning**: If you don't want to use SSL, you can skip steps 1 and 2 and edit conf files in _**docker/server/apache/sites-enabled/*.conf**_ to remove the SSL configuration.\n\nPlease remove the 443 port in _**docker/server/apache/sites-enabled/*.conf**_ file and use 80 port for HTTP:\n\n```apacheconfig\n\u003cVirtualHost *:80\u003e\n    ServerAdmin webmaster@localhost.com\n    ServerName local.localhost.com\n    ServerAlias local.com\n    DocumentRoot /var/www/local\n\n    ErrorLog /var/www/logs/error-local.log\n    CustomLog /var/www/logs/access-local.log combined\n\n    SSLEngine on\n\tSSLCertificateFile /var/www/certs/local.localhost.com.pem\n\tSSLCertificateKeyFile /var/www/certs/local.localhost.com-key.pem\n\n    \u003cDirectory /var/www/local\u003e\n        Options +Indexes +Includes +FollowSymLinks +MultiViews\n        AllowOverride All\n        Require all granted\n  \u003c/Directory\u003e\n\u003c/VirtualHost\u003e\n```\n\nIf you want to use SSL, please ignore the above warning and follow all the steps below.\n\n### 1. Install SSL certificate\nUsing **mkcert** to create ssl certificate\n\n#### For Ubuntu\n\n```shell\nsudo apt install libnss3-tools\n\nsudo wget https://github.com/FiloSottile/mkcert/releases/download/v1.4.3/mkcert-v1.4.3-linux-amd64 \u0026\u0026 \\\nsudo mv mkcert-v1.4.3-linux-amd64 mkcert \u0026\u0026 \\\nsudo chmod +x mkcert \u0026\u0026 \\\nsudo cp mkcert /usr/local/bin/\n```\n#### For Mac or Windows\n\nPlease check and install mkcert at: https://github.com/FiloSottile/mkcert\n\nNow that the mkcert utility is installed, run the command below to generate and install your local CA:\n\n```shell\nmkcert -install\n```\n\n### 2. Create an SSL certificate for this project\n\nGo to this docker folder and run:\n\n```shell\ncd docker/server/certs\nmkcert local.localhost.com\nmkcert local.lamp.com\n```\n\n### 3. Copy .env.example to .env\n\nGo to this docker folder and run:\n\n```shell\ncp .env.example .env\n```\n\n### 4. Edit .env file\n\n```dotenv\nPHP_VERSION_SELECTED=8.2 # Choose the PHP version for your project\n\nAPP_NAME=lamp-local # name of your docker project\nAPP_PORT=91 # port for docker server (apache)\nSSL_PORT=445 # port for docker server (apache) with SSL\nDB_PORT=13393 # port for a database (MariaDB)\n\nMYSQL_ROOT_PASS=root\nMYSQL_USER=root\nMYSQL_PASS=root\nMYSQL_DB=lamp-local # name of your database\n\nPHPMYADMIN_PORT=19011 # port for phpmyadmin (database admin)\nPHPMYADMIN_UPLOAD_LIMIT # upload limit for phpmyadmin\nIP_DB_SERVER=127.0.0.1\n\nREDIS_PORT=16379 # port for Redis (in-memory database)\n```\n\n### 4. Run to start the containers\n\nGo to this docker folder and run:\n\n```shell\ndocker-compose up -d\n```\n\n## Check the network ID and connect the Database\n\n### 1. Check CONTAINER_ID\n- Run `docker ps` to check the Container ID of **APP_NAME-db**\n- Run the command `docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' \u003ccontainer_ID\u003e`\n\n```shell\ndocker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' \u003ccontainer_ID\u003e\n```\n\n![image](https://user-images.githubusercontent.com/35853002/232272286-4dd7cc26-1257-4b1e-9605-7d6ecfd69a37.png)\n\n### 2. Connect to Database\n\nUse the IP address to connect to the database using the database management system (DBMS) of your choice. For example, using MySQL Workbench:\n\n![image](https://user-images.githubusercontent.com/35853002/232210044-7dd5aafa-352f-45d8-ba99-82cb792b1066.png)\n\nYou can also connect to the database using the DB_PORT in the .env file\n\nFor example, using MySQL Workbench: DB_PORT=13393\n\n![image](https://user-images.githubusercontent.com/35853002/232210171-af56d440-c9f0-4477-a1a7-338b86995cd7.png)\n\n## Demo\n\nThis is a demo of the project with the environment variable **PHP_VERSION_SELECTED=8.2**\n\n![image](https://user-images.githubusercontent.com/35853002/235107675-f73e4f5a-2748-41f1-a21c-7419d44b82e8.png)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcslant%2Flamp-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcslant%2Flamp-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcslant%2Flamp-docker/lists"}