{"id":13697813,"url":"https://github.com/adhocore/docker-lemp","last_synced_at":"2025-08-14T08:18:44.589Z","repository":{"id":36561724,"uuid":"167786165","full_name":"adhocore/docker-lemp","owner":"adhocore","description":"A single container LEMP complete fullstack with latest release of PHP8.0.30/8.1.29/8.2.23/8.3.11, MySQL, nginx, PostgreSQL, mailcatcher, beanstalkd, elasticsearch, memcached, redis, adminer and all you ever need; on top alpine3.17+ for both arm and amd arch","archived":false,"fork":false,"pushed_at":"2024-09-09T10:09:52.000Z","size":136,"stargazers_count":163,"open_issues_count":5,"forks_count":45,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-02T12:18:24.224Z","etag":null,"topics":["adhocore","alpine-linux","beanstalkd","docker","docker-lemp","docker-php","elasticsearch","lemp","local-development","mailcatcher","memcached","mysql","nginx","php8","phpfpm","postgres","redis","stack"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/adhocore/lemp","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adhocore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"adhocore","custom":["https://paypal.me/ji10"]}},"created_at":"2019-01-27T08:20:36.000Z","updated_at":"2025-03-01T06:43:31.000Z","dependencies_parsed_at":"2023-01-17T02:38:12.804Z","dependency_job_id":"89863855-3205-46fb-8431-bbfd531fbf10","html_url":"https://github.com/adhocore/docker-lemp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhocore%2Fdocker-lemp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhocore%2Fdocker-lemp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhocore%2Fdocker-lemp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhocore%2Fdocker-lemp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adhocore","download_url":"https://codeload.github.com/adhocore/docker-lemp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119556,"owners_count":21050789,"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","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":["adhocore","alpine-linux","beanstalkd","docker","docker-lemp","docker-php","elasticsearch","lemp","local-development","mailcatcher","memcached","mysql","nginx","php8","phpfpm","postgres","redis","stack"],"created_at":"2024-08-02T18:01:03.197Z","updated_at":"2025-04-09T22:19:35.661Z","avatar_url":"https://github.com/adhocore.png","language":"Dockerfile","readme":"## docker-lemp\n\n[![Docker build](https://github.com/adhocore/docker-lemp/actions/workflows/build.yml/badge.svg)](https://github.com/adhocore/docker-lemp/actions/workflows/build.yml)\n[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Complete+LEMP+fullstack+for+local+development+using+docker\u0026url=https://github.com/adhocore/docker-lemp\u0026hashtags=docker,lemp,fullstack,localdev)\n[![Support](https://img.shields.io/static/v1?label=Support\u0026message=%E2%9D%A4\u0026logo=GitHub)](https://github.com/sponsors/adhocore)\n\u003c!-- [![Donate 15](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square\u0026label=donate+15)](https://www.paypal.me/ji10/15usd)\n[![Donate 25](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square\u0026label=donate+25)](https://www.paypal.me/ji10/25usd)\n[![Donate 50](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square\u0026label=donate+50)](https://www.paypal.me/ji10/50usd) --\u003e\n\n\n\u003e Do not use this LEMP in Production.\n\u003e For production, use [adhocore/phpfpm](https://github.com/adhocore/docker-phpfpm)\n\u003e then [compose](https://docs.docker.com/compose/install/) a stack using individual `nginx`, `redis`, `mysql` etc images.\n\n[`adhocore/lemp`](https://hub.docker.com/r/adhocore/lemp) is a minimal single container LEMP full stack for local development.\n\nIt is quick jumpstart for onboarding you into docker based development.\nThe download size is just about ~350MB which is tiny considering how much tools and stuffs it contains.\n\nThe docker container `adhocore/lemp` is composed of:\n\nName             | Version    | Port\n-----------------|------------|------\nadminerevo       | 4.8.4      | 80\nalpine           | 3.16       | -\nbeanstalkd       | 1.12       | 11300\nelasticsearch    | 6.4.3      | 9200,9300\nmailcatcher      | 0.7.1      | 88,25\nmemcached        | 1.6.15     | 11211\nMySQL`*`         | 5.7        | 3306\nnginx            | 1.21.1     | 80\n~phalcon~`\"`     | 5.0.3      | -\nPHP8.3`+`        | \u003e=8.3.4    | 9000\nPHP8.2`+`        | \u003e=8.2.17   | 9000\nPHP8.1`+`        | \u003e=8.1.27   | 9000\nPHP8.0`+`        | \u003e=8.0.30   | 9000\nPHP7.4`~`        | \u003e=7.4.33   | 9000\nPostgreSQL       | 14.7       | 5432\n~rabbitmq~`^`    | 3.8.*      | 5672\nredis            | 7.0.10     | 6379\n~swoole~`\"`      | 4.8.9      | -\n\n\u003e `*`: Actually [MariaDB 10.6.12](https://mariadb.com/kb/en/mariadb-vs-mysql-compatibility/).\n\n\u003e `+`: Different image tags each, viz `:8.3`, `:8.2`, `:8.1`, `:8.0` and `:7.4`.\n\n\u003e `~`: PHP 7.4 has reached end of life and is **deprecated**.\n\n\u003e `\"`: swoole, phalcon have been disabled for now in order to optimize and speed up multiplatform builds (amd64/arm64) but can be [added back](https://github.com/adhocore/docker-lemp/issues/41#issuecomment-1639873818).\n\n## Usage\n\nInstall [docker](https://docs.docker.com/install/) in your machine.\nAlso recommended to install [docker-compose](https://docs.docker.com/compose/install/).\n\n```sh\n# pull latest image\ndocker pull adhocore/lemp:8.3\n\n# or with PHP8.2\ndocker pull adhocore/lemp:8.2\n\n# or with PHP8.1\ndocker pull adhocore/lemp:8.1\n\n# or with PHP8.0\ndocker pull adhocore/lemp:8.0\n\n# or if you *still* use php 7.4 (which you should not):\ndocker pull adhocore/lemp:7.4\n\n# Go to your project root then run\ndocker run -p 8080:80 -p 8888:88 -v `pwd`:/var/www/html --name lemp -d adhocore/lemp:8.3\n\n# In windows, you would use %cd% instead of `pwd`\ndocker run -p 8080:80 -p 8888:88 -v %cd%:/var/www/html --name lemp -d adhocore/lemp:8.3\n\n# If you want to setup MySQL credentials, pass env vars\ndocker run -p 8080:80 -p 8888:88 -v `pwd`:/var/www/html \\\n  -e MYSQL_ROOT_PASSWORD=1234567890 -e MYSQL_DATABASE=appdb \\\n  -e MYSQL_USER=dbuser -e MYSQL_PASSWORD=123456 \\\n  --name lemp -d adhocore/lemp:8.2\n  # for postgres you can pass in similar env as for mysql but with PGSQL_ prefix\n```\n\nAfter running container as above, you will be able to browse [localhost:8080](http://localhost:8080)!\n\nThe database adminerevo will be available for [mysql](http://localhost:8080/adminerevo?server=127.0.0.1%3A3306\u0026username=root)\nand [postgres](http://localhost:8080/adminerevo?pgsql=127.0.0.1%3A5432\u0026username=postgres).\n\nThe mailcatcher will be available at [localhost:8888](http://localhost:8888) which displays mails in realtime.\n\n### Stop container\n\nTo stop the container, you would run:\n\n```sh\ndocker stop lemp\n```\n\n### (Re)Start container\n\nYou dont have to always do `docker run` as in above unless you removed or lost your `lemp` container.\n\nInstead, you can just start when needed:\n\n```sh\ndocker start lemp\n```\n\n\u003e **PRO** If you develop multiple apps, you can create multiple lemp containers with different names.\n\u003e\n\u003e eg: `docker run -p 8081:80 -v $(pwd):/var/www/html --name new-lemp -d adhocore/lemp:8.3`\n\n\n## With Docker compose\n\nCreate a `docker-compose.yml` in your project root with contents something similar to:\n\n```yaml\n# ./docker-compose.yml\nversion: '3'\n\nservices:\n  app:\n    image: adhocore/lemp:8.3\n    # For different app you can use different names. (eg: )\n    container_name: some-app\n    volumes:\n      # app source code\n      - ./path/to/your/app:/var/www/html\n      # db data persistence\n      - db_data:/var/lib/mysql\n      # Here you can also volume php ini settings\n      # - /path/to/zz-overrides:/usr/local/etc/php/conf.d/zz-overrides.ini\n    ports:\n      - 8080:80\n    environment:\n      MYSQL_ROOT_PASSWORD: supersecurepwd\n      MYSQL_DATABASE: appdb\n      MYSQL_USER: dbusr\n      MYSQL_PASSWORD: securepwd\n      # for postgres you can pass in similar env as for mysql but with PGSQL_ prefix\n\nvolumes:\n  db_data: {}\n```\n\nThen all you gotta do is:\n\n```sh\n# To start\ndocker-compose up -d\n\n# To stop\ndocker-compose stop\n```\n\nAs you can see using compose is very neat, intuitive and easy.\nPlus you can already set the volumes and ports there, so you dont have to type in terminal.\n\n### MySQL Default credentials\n\n- **root password**: 1234567890 (if `MYSQL_ROOT_PASSWORD` is not passed)\n- **user password**: 123456 (if `MYSQL_USER` is passed but `MYSQL_PASSWORD` is not)\n\n### PgSQL Default credentials\n\n- **postgres password**: 1234567890 (if `PGSQL_ROOT_PASSWORD` is not passed)\n- **user password**: 123456 (if `PGSQL_USER` is passed but `PGSQL_PASSWORD` is not)\n\n\n#### Accessing DB\n\nIn PHP app you can access MySQL db via PDO like so:\n```php\n$db = new PDO(\n    'mysql:host=127.0.0.1;port=3306;dbname=' . getenv('MYSQL_DATABASE'),\n    getenv('MYSQL_USER'),\n    getenv('MYSQL_PASSWORD')\n);\n```\n\nYou can access PgSQL db via PDO like so:\n```php\n$pdb = new PDO(\n    'pgsql:host=127.0.0.1;port=5432;dbname=' . getenv('PGSQL_DATABASE'),\n    getenv('PGSQL_USER'),\n    getenv('PGSQL_PASSWORD')\n);\n```\n\n### Nginx\n\nURL rewrite is already enabled for you.\n\nEither your app has `public/` folder or not, the rewrite adapts automatically.\n\n### PHP\n\nFor available extensions, check [adhocore/phpfpm#extensions](https://github.com/adhocore/docker-phpfpm#extensions).\n\n### Disabling services\n\n[Pass in env var](https://www.cloudsavvyit.com/14081/how-to-pass-environment-variables-to-docker-containers/)\n`DISABLE` to the container in CSV format to disable services.\nThe service names must be one or more of below in comma separated format:\n```\nbeanstalkd\nmailcatcher\nmemcached\nmysql\npgsql\nredis\n```\n\n\u003e Example: `DISABLE=beanstalkd,mailcatcher,memcached,pgsql,redis`\n\u003e Essential services like `nginx`, `php`, `adminerevo` cannot be disabled ;).\n\nThe service(s) will be enabled again if you run the container next time without `DISABLE` env or if you remove specific services from `DISABLE` CSV.\n\n### Testing mailcatcher\n\n```sh\n# open shell\ndocker exec -it lemp sh\n\n# send test mail\necho \"\\n\" | sendmail -S 0 test@localhost\n```\n\nThen you will see the new mail in realtime at http://localhost:8888.\n\nOr you can check it in shell as well:\n```sh\n\ncurl 0:88/messages\n```\n","funding_links":["https://github.com/sponsors/adhocore","https://paypal.me/ji10","https://www.paypal.me/ji10/15usd","https://www.paypal.me/ji10/25usd","https://www.paypal.me/ji10/50usd"],"categories":["Development Environment","Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadhocore%2Fdocker-lemp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadhocore%2Fdocker-lemp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadhocore%2Fdocker-lemp/lists"}