{"id":23479593,"url":"https://github.com/tuurlijk/docker-local","last_synced_at":"2025-10-11T05:34:23.971Z","repository":{"id":140901109,"uuid":"178650921","full_name":"Tuurlijk/docker-local","owner":"Tuurlijk","description":"Docker compose development environment","archived":false,"fork":false,"pushed_at":"2025-02-15T13:17:37.000Z","size":214,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-06T21:56:24.311Z","etag":null,"topics":["compose","development","docker","local"],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/Tuurlijk.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null},"funding":{"patreon":"michielroos"}},"created_at":"2019-03-31T06:24:00.000Z","updated_at":"2025-02-15T13:17:41.000Z","dependencies_parsed_at":"2023-12-06T09:28:16.371Z","dependency_job_id":"f06b3f57-ba62-4f0e-9c24-5e0b620abd82","html_url":"https://github.com/Tuurlijk/docker-local","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Tuurlijk/docker-local","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tuurlijk%2Fdocker-local","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tuurlijk%2Fdocker-local/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tuurlijk%2Fdocker-local/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tuurlijk%2Fdocker-local/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tuurlijk","download_url":"https://codeload.github.com/Tuurlijk/docker-local/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tuurlijk%2Fdocker-local/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006322,"owners_count":26084085,"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-10-11T02:00:06.511Z","response_time":55,"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":["compose","development","docker","local"],"created_at":"2024-12-24T19:32:44.123Z","updated_at":"2025-10-11T05:34:23.957Z","avatar_url":"https://github.com/Tuurlijk.png","language":"Shell","funding_links":["https://patreon.com/michielroos"],"categories":[],"sub_categories":[],"readme":"# docker compose setup for local development\nThis development environment uses as much default docker containers as possible.\n\n* Default [nginx](https://hub.docker.com/r/fholzer/nginx-brotli) container - Nginx container with brotli support\n* Default [mariadb](https://hub.docker.com/_/mariadb) container - serves the database\n* Default [mailpit](https://hub.docker.com/r/axllent/mailpit) container - catches all outgoing mail and displays it\n* Default [docker-hoster](https://hub.docker.com/r/dvdarias/docker-hoster) container - makes the containers accessible by name\n* Default [busybox](https://hub.docker.com/_/busybox) container - used for initialization\n* Default [blackfire](https://hub.docker.com/r/blackfire/blackfire) container - used for profiling your site\n* Default [ngrok](https://hub.docker.com/r/wernight/ngrok) container - used to share your local site with the world\n* Default [dozzle](https://hub.docker.com/r/amir20/dozzle) container - used to inspect the logs in browser\n* Slightly changed php container (added graphicsmagick, rsync and some php modules) - serves up php\n\nDisclaimer: This was developed and tested on Linux. OSX has some limitations when it comes to easy access to docker hosts by hostname: [Docker Known limitations, use cases, and workarounds](https://docs.docker.com/docker-for-mac/networking/#known-limitations-use-cases-and-workarounds)\n\nPull requests are welcome ;-)\n\n## Installation\n\n```bash\nmkdir project \u0026\u0026 cd project\ngit clone https://github.com/Tuurlijk/docker-local.git .docker\nln -s .docker/.env .env\n```\n\n### Make sure the containers can read and write your files\nThe different container processes run under different user ids. The containers must be able to read, and some must be able to write host files mounted as volumes inside the container. The default user and group id's the processes are set to run as are 1000 and 1000. If your uid and gid are not `1000`, set the `UID` and `GID` env vars in the `.env` file.\n\nYou can see your uid and gid by doing `id -u` and `id -g`.\n\n### Set the project name in .env\n\nSet up a project name in the `.env` file.\n```bash\n# Project name\nCOMPOSE_PROJECT_NAME=my_great_project\n```\n\n### Start the environment\n\nAdjust other env vars if needed. When you are done, you can start the environment with:\n```bash\ndocker-compose -f .docker/docker-compose.yml up\n```\n\nFor ease of use you can create an alias:\n```bash\nalias dc=\"docker-compose -f .docker/docker-compose.yml\"\n```\n\n### The service user\n\nThe services in the `web` and `php*` containers run under user **docker**. If you want to log in to the php container as that user you can do:\n\n```bash\ndev exec -u docker php /bin/bash\n\n# If you are logging is as your host user, you can do:\ndev exec -u $UID php /bin/bash\n\n# Or even leave out the user part all together:\ndev exec php /bin/bash\n```\n\nYou can create an alias, so you don't have to type the user out all the time.\n```bash\nalias de=\"dev -u $UID exec\"\n```\n\n### Aliases\n\nBonus aliases:\n```bash\n# Colorful messages\ne_header()  { echo -e \"\\n\\033[1m$@\\033[0m\"; }\ne_success() { echo -e \" \\033[1;32m✔\\033[0m  $@\"; }\ne_error()   { echo -e \" \\033[1;31m✖\\033[0m  $@\"; }\n\n# Docker\nalias d=docker\nalias dp=\"docker ps\"\nalias dc=\"docker-compose -f .docker/docker-compose.yml\"\nalias dev=\"docker-compose -f .docker/docker-compose.yml\"\nalias down='f(){ dev rm -fsv $@; unset -f f; }; f'\nalias up='f(){ dev up -d $@ \u0026\u0026 dev logs -f before_script after_script; unset -f f; }; f'\nalias on=up\nalias off=down\nalias re='f(){ dev rm -fsv $@ \u0026\u0026 dev build $@ \u0026\u0026 dev up -d $@ \u0026\u0026 dev logs -f before_script after_script; unset -f f; }; f'\nalias offon=re\nalias ds=\"dev exec php bash -l\"\nalias de=\"dev exec\"\nalias cf='e_header \"Running typo3cms cache:flush\"; ds -c \"./public/bin/typo3cms cache:flush\"; e_success Done'\nalias ct='e_header \"Clearing ./public/typo3temp/*\"; ds -c \"echo removing \\`find ./public/typo3temp/ -type f | wc -l\\` files; rm -rf ./public/typo3temp/*\"; e_success Done'\n```\n\n## SSL support\nTo generate the certificates and make the system trust them, we use [the fantastic *mkcert* tool](https://github.com/FiloSottile/mkcert).\n\nThe provided certificate has wildcards for:\n* *.dev.local\n* *.blackfire.local\n* *.black.local\n* *.fire.local\n* *.bf.local\n* *.xdebug.local\n* *.debug.local\n* *.xdbg.local\n* *.mail.local\n* *.logs.local\n\nThe certificate was generated from the `web/ssl` folder using:\n\n```bash\nmkcert -cert-file public.crt -key-file private.rsa \"dev.local\" \"*.dev.local\" \"*.xdebug.local\" \"*.xdbg.local\" \"*.blackfire.local\" \"*.bf.local\" \"*.black.local\" \"*.fire.local\" \"*.debug.local\" \"*.mail.local\" \"*.logs.local\"\n```\n\n## Configuration\nEach container may use configuration files from the `.docker` folder.\n\nThe environment file `/.env` defines some important variables. Check yout platform documentation so you know what version of PHP and Mariadb you need. For TYPO3 you can find the requirements here: https://get.typo3.org/version\n\n### COMPOSE_PROJECT_NAME\nThe project name is used in the domain names of the http containers:\n* [prefix.dev.local](https://prefix.dev.local) - default PHP\n* [prefix.xdebug.local](https://prefix.xdebug.local) / [prefix.debug.local](https://prefix.debug.local) / [prefix.xdbg.local](https://prefix.xdbg.local) - Xdebug enabled PHP\n* [prefix.blackfire.local](https://prefix.blackfire.local) / [prefix.bf.local](https://prefix.bf.local) / [prefix.fire.local](https://prefix.fire.local) / [prefix.black.local](https://prefix.black.local) - Blackfire enabled PHP\n* [prefix.mail.local](https://prefix.mail.local) - Mailpit\n* [prefix.logs.local](https://prefix.logs.local) - Dozzle\n\nAll environments are started within their own subnet. They can reach each other by the *service name* or *container_name* specified in `.docker/docker-compose.yml`. So the `php` machine can reference the `redis` machine by using hostname **redis** or **container_name: ${COMPOSE_PROJECT_NAME}_web**. So if your project name is **babel** the `php` machine can reach the `redis` machine by using **babel_redis** as hostname.\n\n### PHP versions\nThere are different PHP versions available. The default is PHP 7.4\n\n#### PHP_VERSION\nOne of: `5.6`, `7.1`, `7.2`, `7.3`, `7.4`, `8.0`, `8.1`\n\n### Database version\n[One of the mariadb versions](https://hub.docker.com/_/mariadb). The default is 10.2\n\n#### DATABASE_VERSION\nOne of teh tags on https://hub.docker.com/_/mariadb\n\n### mysql database credentials\n\n#### MYSQL_DATABASE\nThe name of the database that mysql will import the dump into\n\n#### MYSQL_USER\nThe name of the mysql user\n\n#### MYSQL_PASSWORD\nThe password of the mysql user\n\n#### MYSQL_ROOT_PASSWORD\nThe password of the mysql root user\n\n### Ngrok\nExpose a local web server to the internet. Share your local development environment with others\n\n#### NGROK_AUTH\nYour token from https://dashboard.ngrok.com/auth\n\n*This option is commented out by default because you are better of setting it globally in your shell environment.*\n\n#### NGROK_PORT=prefix.dev.local:443\nHostname and port of the exposed website\n\n#### NGROK_USERNAME\nUsername for htaccess based authentication of the exposed website\n\n#### NGROK_PASSWORD\nPassword for htaccess based authentication of the exposed website\n\n### Blackfire credentials\nUse blackfire to profile your PHP code. Get the credentials from https://blackfire.io/my/settings/credentials\n\n#### BLACKFIRE_CLIENT_ID\nClient id\n\n*This option is commented out by default because you are better of setting it globally in your shell environment.*\n\n#### BLACKFIRE_CLIENT_TOKEN\nClient token\n\n*This option is commented out by default because you are better of setting it globally in your shell environment.*\n\n#### BLACKFIRE_SERVER_ID\nServer id\n\n*This option is commented out by default because you are better of setting it globally in your shell environment.*\n\n#### BLACKFIRE_SERVER_TOKEN\nServer token\n\n*This option is commented out by default because you are better of setting it globally in your shell environment.*\n\n#### HOSTMAP_IMAGE\nBy default the **[dvdarias/docker-hoster](https://hub.docker.com/r/dvdarias/docker-hoster)** image is started. This may give trouble if you start multiple environments. Docker-hoster does not seem to cope too well. An alternative is to start a standalone image that does docker dns like [kevinjqiu/resolvable](https://hub.docker.com/r/kevinjqiu/resolvable).\n\nIf you opt for that, you can set **HOSTMAP_IMAGE** to **bash**.\n\nExample resolvable config:\n```yaml\nversion: \"3\"\nservices:\n  resolvable:\n    image: kevinjqiu/resolvable\n    restart: always\n    volumes:\n      - /var/run/docker.sock:/tmp/docker.sock:ro\n      - /etc/resolv.conf:/tmp/resolv.conf\n```\n\n### TEMPLATE ###\nUse a template to get an installation up quickly. Each template has a `before.sh` file to set up the environment before any machine starts and an `after.sh` file to set up the environment after the machines have started. This may fix permissions and copy over files like composer.json and AdditionalConfiguration.php.\n\nPlease keep in mind that you may need to tweak the MariaDb and PHP versions for the older TYPO3 versions.\n\nChoose from:\n* empty\n* default\n* TYPO3-v7\n* TYPO3-v8\n* TYPO3-v9\n* TYPO3-v10\n* TYPO3-v11\n* Neos-v4\n\nAdd your own templates in .docker/template/\n\n## Scripts\nThere are a few helper scripts in `.docker/bin`. Most of these are meant to be executed from the project root (where the .env file is stored).\n\n### Dumping a database\nThere is a script in `.docker/bin/` called `dump.sh`. It uses the database credentials defined in the `.env` file to dump the database from the database host. You can execute it by doing:\n```bash\n./.docker/bin/dump.sh\n```\nThe database dump will be stored in `.docker/db/dump`.\n\n### Importing a database\nThere is a script in `.docker/bin/` called `import.sh`. It uses the database credentials defined in the `.env` file to import a database to the database host. You can execute it by doing:\n```bash\n./.docker/bin/import.sh dumpfile.sql.gz\n```\n\n### Automatically importing a database\nAny files in `.docker/db/import` ending in `tar.gz`, `sql` or `gz` will be imported. This can be of use to you if you wish to execute SQL on each run of the db container. Also nice if you want to run a databbase in ram, because then you will need to re-import the data on each run of the container.\n\n## Run database in ram\nThe database in the container is already pretty fast if you have a ssd, But if you want more speed, you can run it in ram.\n\nThe database can run in a tmpfs volume. If you want to save it, please use `./.docker/bin/dump.sh`. This will create a gzipped dump in `.docker/db/dump`.\n\nIf you want to run the db in ram, uncomment the dbData volume lines at the end of docker-compose.override.yml:\n\n```yaml\n#volumes:\n#  dbData:\n#    driver_opts:\n#      type: tmpfs\n#      device: tmpfs\n#      o: \"noatime,noexec,nodiratime,nodev,nosuid,async,mode=0770,uid=${UID:-1000},gid=${GID:-1000}\"\n```\n\n## Ephemeral\n\nThe containers are ephemeral as suggested in [Best practices for writing Docker files](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/)\n\n*The image defined by your Dockerfile should generate containers that are as ephemeral as possible. By “ephemeral”, we mean that the container can be stopped and destroyed, then rebuilt and replaced with an absolute minimum set up and configuration.*\n\nOf course all the files in your project directory remain in place, but temporary stuff like `public/typo3temp` and `var` run in ramdisk (tmpfs) volumes that will be removed when the machines stop.\n\n## PHPStorm Xdebug\nIn `docker-compose.yml` an environment variable is set: `PHP_IDE_CONFIG=serverName=${COMPOSE_PROJECT_NAME}`. Make sure that you have this [server configured in PHPStorm](https://www.jetbrains.com/help/phpstorm/servers.html). The **name** of the server must be the value of your `COMPOSE_PROJECT_NAME`.\n\n## Cool stuff\n\n[lazydocker](https://github.com/jesseduffield/lazydocker) cli tool for inspecting your docker environment\n\n## Known Issues\n* Sometimes the var and Web directories get created with owner and group root. This breaks the installation.\n* Mariadb fails to set the configured charset on first image start. This may be a problem of the stock [MariaDb docker image](https://hub.docker.com/_/mariadb).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuurlijk%2Fdocker-local","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftuurlijk%2Fdocker-local","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuurlijk%2Fdocker-local/lists"}