{"id":15043076,"url":"https://github.com/osteel/docker-tutorial","last_synced_at":"2025-04-09T07:09:56.282Z","repository":{"id":46589930,"uuid":"48241295","full_name":"osteel/docker-tutorial","owner":"osteel","description":"Companion repository for a tutorial series about using Docker locally for web development","archived":false,"fork":false,"pushed_at":"2023-04-17T13:42:28.000Z","size":5945,"stargazers_count":162,"open_issues_count":0,"forks_count":55,"subscribers_count":9,"default_branch":"part-1","last_synced_at":"2025-04-02T06:07:06.747Z","etag":null,"topics":["docker","docker-compose","laravel","php","webdevelopment"],"latest_commit_sha":null,"homepage":"https://tech.osteel.me/posts/docker-for-local-web-development-introduction-why-should-you-care","language":"PHP","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/osteel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2015-12-18T15:07:26.000Z","updated_at":"2024-12-28T15:15:35.000Z","dependencies_parsed_at":"2024-09-25T01:47:12.494Z","dependency_job_id":"260c3579-4933-48a0-a6e6-404e6eda90ea","html_url":"https://github.com/osteel/docker-tutorial","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osteel%2Fdocker-tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osteel%2Fdocker-tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osteel%2Fdocker-tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osteel%2Fdocker-tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osteel","download_url":"https://codeload.github.com/osteel/docker-tutorial/tar.gz/refs/heads/part-1","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247994122,"owners_count":21030050,"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":["docker","docker-compose","laravel","php","webdevelopment"],"created_at":"2024-09-24T20:48:32.463Z","updated_at":"2025-04-09T07:09:56.242Z","avatar_url":"https://github.com/osteel.png","language":"PHP","readme":"# Docker for local web development, part 1: a basic LEMP stack\n\nThis repository accompanies a [tutorial series](https://tech.osteel.me/posts/docker-for-local-web-development-why-should-you-care \"Docker for local web development, introduction: why should you care?\") about leveraging Docker for local web development.\n\nThe current branch covers part 1 of the series, which is about setting up a basic LEMP stack with Docker Compose. Please refer to the [full article](https://tech.osteel.me/posts/docker-for-local-web-development-part-1-a-basic-lemp-stack \"Docker for local web development, part 1: a basic LEMP stack\") for a detailed explanation.\n\n## Content\n\nThis branch contains a basic LEMP stack running on Docker and orchestrated by Docker Compose, including:\n\n* A container for Nginx;\n* A container for PHP-FPM;\n* A container for MySQL;\n* A container for phpMyAdmin;\n* A volume to persist MySQL data.\n\n## Prerequisites\n\nMake sure [Docker Desktop for Mac or PC](https://www.docker.com/products/docker-desktop) is installed and running, or head [over here](https://docs.docker.com/install/) if you are a Linux user. You will also need a terminal running [Git](https://git-scm.com/).\n\nThis setup also uses localhost's port 80, so make sure it is available.\n\n## Directions of use\n\nAdd the following domain to your machine's `hosts` file:\n\n```\n127.0.0.1 php.test\n```\n\nClone the repository and change the current directory for the project's root:\n\n```\n$ git clone git@github.com:osteel/docker-tutorial.git\n$ cd docker-tutorial\n```\n\nCopy `.env.example` to `.env`:\n\n```\n$ cp .env.example .env\n```\n\nRun the following command:\n\n```\n$ docker compose up -d\n```\n\nThis may take a little bit of time, as some Docker images might need downloading.\n\nOnce the script is done, visit [php.test](http://php.test).\n\n## Explanation\n\nThe images used by the setup are listed and configured in [`docker-compose.yml`](https://github.com/osteel/docker-tutorial/blob/part-1/docker-compose.yml).\n\nWhen building and starting the containers based on the images for the first time, a MySQL database named `demo` is automatically created (you can pick a different name in the MySQL service's description in `docker-compose.yml`).\n\nA [minimalist Nginx configuration](https://github.com/osteel/docker-tutorial/blob/part-1/.docker/nginx/conf.d/php.conf) for the PHP application is also copied over to Nginx's container, making it available at [php.test](http://php.test).\n\nThe `src/` directory containing the application is mounted onto both Nginx's and the application's containers, meaning any update to the code is immediately available upon refreshing the page, without having to rebuild any container.\n\nThe database data is persisted in its own local directory through the volume `mysqldata`, which is mounted onto MySQL's container. A phpMyAdmin interface is available at [localhost:8080](http://localhost:8080) (the database credentials are root / root).\n\nPlease refer to the [full article](https://tech.osteel.me/posts/docker-for-local-web-development-part-1-a-basic-lemp-stack \"Docker for local web development, part 1: a basic LEMP stack\") for a detailed explanation.\n\n## Cleaning up\n\nTo stop the containers:\n\n```\n$ docker compose stop\n```\n\nTo destroy the containers:\n\n```\n$ docker compose down\n```\n\nTo destroy the containers and the associated volumes:\n\n```\n$ docker compose down -v\n```\n\nTo remove everything, including images and orphan containers:\n\n```\n$ docker compose down -v --rmi all --remove-orphans\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosteel%2Fdocker-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosteel%2Fdocker-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosteel%2Fdocker-tutorial/lists"}