{"id":13563575,"url":"https://github.com/tighten/takeout","last_synced_at":"2025-04-10T02:14:37.094Z","repository":{"id":37589306,"uuid":"262361837","full_name":"tighten/takeout","owner":"tighten","description":"Docker-based development-only dependency manager. macOS, Linux, and WSL2-only and installs via PHP's Composer... for now.","archived":false,"fork":false,"pushed_at":"2025-04-04T18:09:03.000Z","size":86404,"stargazers_count":1627,"open_issues_count":4,"forks_count":83,"subscribers_count":21,"default_branch":"main","last_synced_at":"2025-04-10T02:14:25.965Z","etag":null,"topics":["docker","docker-containers","hacktoberfest","mysql","takeout"],"latest_commit_sha":null,"homepage":"","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/tighten.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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":"2020-05-08T15:37:35.000Z","updated_at":"2025-04-04T18:08:46.000Z","dependencies_parsed_at":"2023-02-12T00:00:53.185Z","dependency_job_id":"14d670f2-5c91-4fe3-83c7-532fa8a77b52","html_url":"https://github.com/tighten/takeout","commit_stats":null,"previous_names":[],"tags_count":56,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tighten%2Ftakeout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tighten%2Ftakeout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tighten%2Ftakeout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tighten%2Ftakeout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tighten","download_url":"https://codeload.github.com/tighten/takeout/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142903,"owners_count":21054671,"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-containers","hacktoberfest","mysql","takeout"],"created_at":"2024-08-01T13:01:20.861Z","updated_at":"2025-04-10T02:14:37.069Z","avatar_url":"https://github.com/tighten.png","language":"PHP","readme":"![Takeout - Docker-based dependency management](takeout-banner.png?version=1)\n\n# Takeout\n\n[![Run tests](https://github.com/tighten/takeout/workflows/Run%20tests/badge.svg?branch=main)](https://github.com/tighten/takeout/actions?query=workflow%3A%22Run+tests%22)\n[![Lint](https://github.com/tighten/takeout/workflows/Lint/badge.svg?branch=main)](https://github.com/tighten/takeout/actions?query=workflow%3ALint)\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/tightenco/takeout.svg?style=flat)](https://packagist.org/packages/tightenco/takeout)\n[![Downloads on Packagist](https://img.shields.io/packagist/dt/tightenco/takeout.svg?style=flat)](https://packagist.org/packages/tightenco/takeout)\n\nTakeout is a CLI tool for spinning up tiny Docker containers, one for each of your development environment dependencies.\n\nIt's meant to be paired with a tool like [Laravel Valet](https://laravel.com/docs/valet). It's currently compatible with macOS, Linux, Windows 10 and WSL2.\n\nWith `takeout enable mysql` you're running MySQL, and never have to worry about managing or fixing Homebrew MySQL again.\n\nBut you can also easily enable ElasticSearch, PostgreSQL, MSSQL, Mongo, Redis, and more, with a simple command. For a current list of services, look at the classes available in this directory: https://github.com/tighten/takeout/tree/main/app/Services\n\n## Requirements\n\n-   macOS, Linux, Windows 10 or WSL2\n-   Docker installed (macOS: [Docker for Mac](https://docs.docker.com/docker-for-mac/), Windows: [Docker for Windows](https://docs.docker.com/docker-for-windows/))\n\nIf you opt for the PHP/Composer installation (not recommended), you also need:\n\n-   PHP installed (latest major version)\n-   Composer installed\n\n## Installation\n\nThe recommended way to install Takeout is the dockerized version via an alias (add this to your `~/.bashrc`, `~/.zshrc` or equivalent).\n\nOn Linux or macOS, use:\n\n```bash\nalias takeout=\"docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --add-host=host.docker.internal:host-gateway -it tighten/takeout:latest\"\n```\n\nOn Windows 10|11, if you're using Bash, use:\n\n```bash\nalias takeout=\"docker run --rm -v //var/run/docker.sock:/var/run/docker.sock --add-host=host.docker.internal:host-gateway -it tighten/takeout:latest\"\n```\n\nOn Windows 10|11, if you're using PowerShell, use:\n\n```bash\nfunction takeout { docker run --rm -v //var/run/docker.sock:/var/run/docker.sock --add-host=host.docker.internal:host-gateway -it tighten/takeout:latest $args }\n```\n\nThat's it. You may now use Takeout on your terminal. The first time you use this alias, it will pull the Takeout image from Docker Hub.\n\nTo update the image, run `docker pull tighten/takeout` when you want to get the newest release.\n\nOtherwise, if you have a PHP environment available, you may install Takeout via Composer:\n\n```bash\ncomposer global require \"tightenco/takeout:~2.9\"\n```\n\nIf you use the PHP/Composer installation, make sure you're on the latest version of PHP. We'll only support the current major version of PHP using this installation approach.\n\n## Usage\n\nRun `takeout` and then a command name from anywhere in your terminal.\n\nOne of Takeout's primary benefits is that it boots (\"enables\") or deletes (\"disables\") Docker containers for your various dependencies quickly and easily.\n\nBecause Docker offers persistent volume storage, deleting a container (which we call \"disabling\" it) doesn't actually delete its data. That means you can enable and disable services with reckless abandon.\n\n### Enable a service\n\nShow a list of all services you can enable.\n\n```bash\ntakeout enable\n```\n\n### Enable specific services\n\nPassed the short name of one or more services, enable them.\n\n```bash\ntakeout enable mysql\n\ntakeout enable redis meilisearch\n```\n\n### Enable services with default parameters\n\nIf you want to skip over being asked for each parameter and just accept the defaults. This also works with multiple services in one command.\n\n```bash\ntakeout enable mysql --default\n\ntakeout enable redis meilisearch --default\n```\n\n#### Passthrough Container Arguments\n\nYou may specify extra arguments to the container after a `--` sepatator:\n\n```bash\ntakeout enable mysql -- -hsome.mysql.host -usome-user\n```\n\nNotice that these are arguments for the container Entrypoint, not extra docker run options (see below).\n\n#### Extra `docker run` Options\n\nUnder the hood, the `takeout enable` command generates a `docker run` command. Sometimes you may want to specify extra options to the `docker run` command such as an extra environment variable or an extra volume mapping. You can pass a string with all the extra `docker run` options using the `--run=` option:\n\n```bash\ntakeout enable mysql --run=\"{docker-run-options}\"\n```\n\nWhich would generate the following command:\n\n```bash\ndocker run {docker-run-options} {service-options} mysql/mysql-server\n```\n\nWhere `{docker-run-options}` are the options you specify inside the `--run` option and `{service-options}` are generated based on the default options for that service.\n\n#### Mixing `docker run` Options With Container Arguments\n\nYou may mix and match the `run` options with the container arguments:\n\n```bash\ntakeout enable mysql --run=\"{docker-run-options}\" -- -hsome.mysql.host -usome-user\n```\n\n### Disable a service\n\nShow a list of all enabled services you can disable.\n\n```bash\ntakeout disable\n```\n\n### Disable specific services\n\nPassed the short name of one or more services, disable the enabled services that match them most closely.\n\n```bash\ntakeout disable mysql\n\ntakeout disable redis meilisearch\n```\n\n### Disable all services\n\n```bash\ntakeout disable --all\n```\n\n### Start a stopped container\n\nShow a list of all stopped containers you can start.\n\n```bash\ntakeout start\n```\n\n### Start specific stopped containers\n\nPassed the container ID of one or more stopped containers, start the stopped containers that matches them.\n\n```bash\ntakeout start {container_id}\n\ntakeout start {container_id1} {container_id2}\n```\n\n### Start all containers\n\nYou may pass the `-all` flag to start all enabled containers.\n\n```bash\ntakeout start --all\n```\n\n### Stop a running container\n\nShow a list of all running containers you can stop.\n\n```bash\ntakeout stop\n```\n\n### Stop specific running containers\n\nPassed the container ID of one or more running containers, stop the running containers that matches them.\n\n```bash\ntakeout stop {container_id}\n\ntakeout stop {container_id1} {container_id2}\n```\n\n### Get a shell inside any Takeout container\n\nTo get a shell inside any container that is started with Takeout, you may run:\n\n```bash\ntakeout shell {service}\n```\n\nHere are some examples:\n\n```bash\ntakeout shell mysql\ntakeout shell neo4j\ntakeout shell pgvector\n```\n\nThis will open a shell inside the running container for the service you provide. Takeout will start either a `bash` or a `sh` process inside the container, depending on what the container supports.\n\n## Running multiple versions of a dependency\n\nAnother of Takeout's benefits is that it allows you to have multiple versions of a dependency installed and running at the same time. That means, for example, that you can run both MySQL 5.7 and 8.0 at the same time, on different ports.\n\nRun `takeout enable mysql` twice; the first time, you'll want to choose the default port (`3306`) and the first version (`5.7`), and the second time, you'll want to choose a second port (`3307`), the second version (`8.0`) and a different volume name (so that they don't share the same `mysql_data`).\n\nNow, if you run `takeout list`, you'll see both services running at the same time.\n\n```bash\n+--------------+----------------+---------------+-----------------------------------+\n| CONTAINER ID | NAMES          | STATUS        | PORTS                             |\n+--------------+----------------+---------------+-----------------------------------+\n| 4bf3379ab2f5 | TO--mysql--5.7 | Up 2 seconds  | 33060/tcp, 0.0.0.0:3306-\u003e3306/tcp |\n| 983acf46ceef | TO--mysql--8.0 | Up 35 seconds | 33060/tcp, 0.0.0.0:3307-\u003e3306/tcp |\n+--------------+----------------+---------------+-----------------------------------+\n```\n\n## Network Details\n\nTakeout containers are automatically added to a Docker network named `takeout`. This allows you to use the same aliasing and base aliasing that is used for the other containers.\n\nEach container is given two aliases on this network:\n\n-   A base_alias based on the core dependency name (e.g. mysql, postgres)\n-   A full_alias combining the base alias and version (e.g. mysql8.0, postgres13)\n\nOther containers on the takeout network can access Takeout containers by their aliases. [Check this article on how you can use sail and takeout together](https://mattstauffer.com/blog/how-to-use-takeout-to-add-new-services-to-laravel-sail-and-save-ram/)\n\n## FAQs\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eWill this enable the PHP drivers for me via PECL?\u003c/strong\u003e\u003c/summary\u003e\n\nSadly, no.\n\n\u003c/details\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eIf I disable a service but Takeout still shows the port as taken, how do I proceed?\u003c/strong\u003e\u003c/summary\u003e\n\nFirst, run `lsof -i :3306` (where 3306 is the port that's unavailable.)\n\nIf you see output like this:\n\n    com.docke   936 mattstauffer   52u  IPv6 0xc0d6f0b06d5c4efb      0t0  TCP localhost:mysql-\u003elocalhost:62919 (FIN_WAIT_2)\n    TablePlus 96155 mattstauffer   16u  IPv4 0xc0d6f0b0b6dccf6b      0t0  TCP localhost:62919-\u003elocalhost:mysql (CLOSE_WAIT)\n\nThe solution is to just close your database GUI, and then it should be released.\n\n\u003c/details\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eWhy would you use this instead of `docker-compose`?\u003c/strong\u003e\u003c/summary\u003e\n\nUsing `docker-compose` sets up your dependencies on a project-by-project basis, which is a perfectly fine way to do things. If it makes more sense to you to have a single copy of each of your dependencies for your entire global environment, Takeout makes more sense.\n\n\u003c/details\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eWill disabling a service permanently delete my databases?\u003c/strong\u003e\u003c/summary\u003e\n\nNope! Your data will stick around! By default almost all of our services use a \"volume\" to attach your data to for exactly this reason.\n\nSo, when you disable the MySQL service, for example, that volume--with all your data in it--will just sit there quietly. And when you re-enable, as long as you attach it to the same volume, all your data will still be there.\n\n\u003c/details\u003e\n\n## Future plans\n\nThe best way to see our future plans is to check out the [Projects Board](https://github.com/tighten/takeout/projects/1), but here are a few plans for the future:\n\n-   Electron-based GUI\n-   `self-remove` command: Deletes all enabled services and then maybe self-uninstalls?\n-   `upgrade`: destroys the old container, brings up a new one with a newly-specified tag (prompt user for it, default `latest`) and keeps all other parameters (e.g. port, volume) exactly the same as the old one\n-   `pt/passthrough`: proxy commands through to docker (`./takeout pt mysql stop`)\n-   Deliver package in a way that's friendly to non-PHP developers (Homebrew? NPM?)\n-   Allow other people to extend Takeout by adding their own plugins (thanks to @angrybrad for the idea!)\n\n## Process for release\n\nIf you're working with us and are assigned to push a release, here's the easiest process:\n\n1. Visit the [Takeout Releases page](https://github.com/tighten/takeout/releases); figure out what your next tag will be (increase the third number if it's a patch or fix; increase the second number if it's adding features)\n2. On your local machine, pull down the latest version of `main` (`git checkout main \u0026\u0026 git pull`)\n3. Build for the version you're targeting (`php ./takeout app:build`)\n4. Run the build once to make sure it works (`php ./builds/takeout list`)\n5. Commit your build and push it up\n6. [Draft a new release](https://github.com/tighten/takeout/releases/new) with both the tag version and release title of your tag (e.g. `v1.5.1`)\n7. Use the \"Generate release notes\" button to generate release notes from the merged PRs.\n8. Hit `Publish release`\n9. The new tag and release will trigger the [`docker-publish.yml`](.github/workflows/docker-publish.yml) workflow, which should take care of building and pushing the new image of the Docker container (see the \"Building The Docker Image Manually\" section below)\n10. Profit 😆\n\n## Building The Docker Image Manually\n\nThe important thing is to remember to build both `linux/amd64` and `linux/arm64` images. We rely on Docker's `buildx` command, which uses Docker's [BuildKit](https://github.com/moby/buildkit) behind the scenes, which allows us to build for multiple platforms, independently of the platform of the machine building the image.\n\nYou may build and publish a new version of the docker image using the following command:\n\n```bash\ndocker buildx build --platform=linux/amd64,linux/arm64 -t tighten/takeout:latest --push .\n```\n\nIf it's the first time you're building the image, you may get the following error:\n\n```\nERROR: Multiple platforms feature is currently not supported for docker driver. Please switch to a different driver (eg. \"docker buildx create --use\")\n```\n\nThis means that you first need to create a builder container, which you maydo like so:\n\n```bash\ndocker buildx create --use\n```\n\nAfter that, retrying the `buildx` command should work.\n\nPlease, note that building the container will simply copy the current version of the Takeout `phar` file at [builds/takeout](./builds/takeout) to inside the container and publish that, so make sure you have to most recent version built locally. If you don't, follow the release process to build the new version before building the Docker image.\n","funding_links":[],"categories":["PHP","配置 Configuration","Configuration","Table of Contents"],"sub_categories":["开发环境 Development Environment","Development Environment"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftighten%2Ftakeout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftighten%2Ftakeout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftighten%2Ftakeout/lists"}