{"id":23165584,"url":"https://github.com/arnaunau/pw2_local_environment_php","last_synced_at":"2026-04-09T02:31:30.147Z","repository":{"id":141324481,"uuid":"601659154","full_name":"ArnauNau/PW2_local_environment_php","owner":"ArnauNau","description":"Docker container configuration to compose a php, nginx, mysql, and phpmyadmin environment ","archived":false,"fork":false,"pushed_at":"2023-02-14T15:03:22.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-21T09:11:10.649Z","etag":null,"topics":["docker","docker-compose","mysql-database","nginx","php","phpmyadmin"],"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/ArnauNau.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-14T14:43:58.000Z","updated_at":"2023-02-23T14:51:43.000Z","dependencies_parsed_at":"2024-06-12T12:20:07.135Z","dependency_job_id":null,"html_url":"https://github.com/ArnauNau/PW2_local_environment_php","commit_stats":null,"previous_names":["arnaunau/pw2_local_environment_php"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ArnauNau/PW2_local_environment_php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArnauNau%2FPW2_local_environment_php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArnauNau%2FPW2_local_environment_php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArnauNau%2FPW2_local_environment_php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArnauNau%2FPW2_local_environment_php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArnauNau","download_url":"https://codeload.github.com/ArnauNau/PW2_local_environment_php/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArnauNau%2FPW2_local_environment_php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31582598,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"online","status_checked_at":"2026-04-09T02:00:06.848Z","response_time":112,"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":["docker","docker-compose","mysql-database","nginx","php","phpmyadmin"],"created_at":"2024-12-18T01:27:38.527Z","updated_at":"2026-04-09T02:31:30.131Z","avatar_url":"https://github.com/ArnauNau.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Local Environment\n\u003e Using Docker for our local environment\n\n## Requirements\n\n1. Having [Docker installed](https://www.docker.com/products/docker-desktop) (you will need to create a Hub account)\n2. Having [Git installed](https://git-scm.com/downloads)\n\n## Installation\n\n1. Clone this repository into your projects folder using the `git clone` command.\n\n## Instructions\n\n1. After cloning the project, open your terminal and access the root folder using the `cd /path/to/the/folder` command.\n2. To start the local environment, execute the command `docker-compose up -d` in your terminal.\n\n**Note:** The first time you run this command it will take some time because it will download all the required images from the Hub.\n\nAt this point, if you execute the command `docker-compose ps` you should see a total of 4 containers running:\n\n```\n       Name                     Command               State                 Ports              \n-----------------------------------------------------------------------------------------------\npw_local_env-admin   entrypoint.sh docker-php-e ...   Up      0.0.0.0:8080-\u003e8080/tcp           \npw_local_env-db      docker-entrypoint.sh mysqld      Up      0.0.0.0:3330-\u003e3306/tcp, 33060/tcp\npw_local_env-nginx   /docker-entrypoint.sh ngin ...   Up      0.0.0.0:8030-\u003e80/tcp             \npw_local_env-php     docker-php-entrypoint php-fpm    Up      9000/tcp, 0.0.0.0:9030-\u003e9001/tcp\n```\n\nAt this point, you should be able to access the application by visiting the following address in your browser [http://localhost:8030/](http://localhost:8030/).\n\n### Database\n\nThere are multiple ways to access the database inside the docker container. In this case we are going to cover two options:\n\n1. Manually accessing the container\n2. Using the adminer image\n\n#### Manually\n\nIn order to manually access the database, we need the name of the database container. Use `docker-compose ps`. The name should be something like `pw_local_env-db`.\n\nNow, we are going to ssh into the container using the command `docker exec -it container_id bash`. At this point, you should be able to notice that the terminal prompt has changed because now you are inside of the container.\n\nTo access the database, execute the command `mysql -u root -p`. (The password is the one specified in the .env file in the **MYSQL_ROOT_PASSWORD** field.)\n\n#### Adminer image\n\nTo access to the admin page, visit the URL [http://localhost:8080/](http://localhost:8080/) in your browser.\n\nThe host should be **db** (the name of the service used in the docker-compose file).\n\nThe user should be **root** and the password is the one specified in the .env file in the **MYSQL_ROOT_PASSWORD** field.\n\n### Shared directories\n\nThe line\n```\nvolumes:\n    - .:/app\n```\n\nin\n\n```\napp:\ncontainer_name: pw_local-php\nbuild:\n    context: .\n    dockerfile: Dockerfile\nrestart: unless-stopped\nports:\n    - \"9030:9001\"\nvolumes:\n    - .:/app\ndepends_on:\n    - db\n```\n\nis telling docker to share the `/app` directory inside docker with the `.` (current) directory on the host machine (your computer). If you change the contents of the php file `public/index.php` you will see the changes when accessing your web at [http://localhost:8080/](http://localhost:8080/).\n\n## QA\n\n1. How to list all the running containers\n\nUse the `docker ps` command. Use the -a flag to list also the stopped ones.\n\n2. How to list all the docker images that I have installed.\n\nRun the command `docker images`\n\n3. How to remove all the images that are no longer used\n\nRun the command `docker image prune`\n\n4. How to check the logs of a specific container\n\nRun the command `docker ps` and copy the id of the container that you want to debug.\n\nNow, run the command `docker logs --follow container_id`.\n\n5. How to _ssh_ into a specific container\n\nRun the command `docker ps` and copy the id of the container that you want to debug.\n\nNow, run the command `docker exec -it container_id bash`.\n\n**Note:** If you are using the alpine version of image, you need to use _ash_ instead of _bash_.\n\n6. Where can I find more docker images to use?\n\nYou can check the [Docker Hub](https://hub.docker.com/).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnaunau%2Fpw2_local_environment_php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farnaunau%2Fpw2_local_environment_php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnaunau%2Fpw2_local_environment_php/lists"}