{"id":20210616,"url":"https://github.com/luisaveiro/localhost-databases","last_synced_at":"2025-07-02T10:35:17.886Z","repository":{"id":61260018,"uuid":"458346800","full_name":"luisaveiro/localhost-databases","owner":"luisaveiro","description":"Collection of Database Docker compose files for local development.","archived":false,"fork":false,"pushed_at":"2025-03-13T23:39:55.000Z","size":4743,"stargazers_count":49,"open_issues_count":0,"forks_count":13,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-08T12:46:25.288Z","etag":null,"topics":["cassandra","cockroachdb","couchdb","database","developer-productivity","docker","docker-compose","dynamodb-local","edgedb","local-development","mariadb","mongodb","mssql","mysql","neo4j","postgresql","redis","surrealdb","yugabytedb"],"latest_commit_sha":null,"homepage":"","language":null,"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/luisaveiro.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["luisaveiro"],"custom":["https://www.buymeacoffee.com/luisaveiro"]}},"created_at":"2022-02-11T21:34:34.000Z","updated_at":"2025-03-13T23:39:58.000Z","dependencies_parsed_at":"2023-11-10T09:43:43.627Z","dependency_job_id":"37b89f3f-391c-4772-8a5b-ffe392c1d64e","html_url":"https://github.com/luisaveiro/localhost-databases","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/luisaveiro/localhost-databases","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisaveiro%2Flocalhost-databases","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisaveiro%2Flocalhost-databases/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisaveiro%2Flocalhost-databases/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisaveiro%2Flocalhost-databases/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luisaveiro","download_url":"https://codeload.github.com/luisaveiro/localhost-databases/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisaveiro%2Flocalhost-databases/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263121428,"owners_count":23416995,"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":["cassandra","cockroachdb","couchdb","database","developer-productivity","docker","docker-compose","dynamodb-local","edgedb","local-development","mariadb","mongodb","mssql","mysql","neo4j","postgresql","redis","surrealdb","yugabytedb"],"created_at":"2024-11-14T05:48:41.961Z","updated_at":"2025-07-02T10:35:17.853Z","avatar_url":"https://github.com/luisaveiro.png","language":null,"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://supportukrainenow.org\" target=\"_blank\"\u003e\n    \u003cimg src=\"./images/standwithukraine.png\" alt=\"#StandWithUkraine\" width=\"100%\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cbr/\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://github.com/luisaveiro/localhost-databases\"\u003e\n    \u003cimg src=\"./images/databases.svg\" alt=\"databases\" width=\"50%\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch4 align=\"center\"\u003e\n  Collection of Database Docker compose files for local development\n\u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#tldr\"\u003eTL;DR\u003c/a\u003e •\n  \u003ca href=\"#about\"\u003eAbout\u003c/a\u003e •\n  \u003ca href=\"#disclaimer\"\u003eDisclaimer\u003c/a\u003e •\n  \u003ca href=\"#getting-started\"\u003eGetting Started\u003c/a\u003e •\n  \u003ca href=\"#download\"\u003eDownload\u003c/a\u003e •\n  \u003ca href=\"#how-to-use\"\u003eHow To Use\u003c/a\u003e •\n  \u003ca href=\"#databases\"\u003eDatabases\u003c/a\u003e •\n  \u003ca href=\"#docker-network\"\u003eDocker Network\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#faq\"\u003eFAQ\u003c/a\u003e •\n  \u003ca href=\"#useful-tips\"\u003eUseful Tips\u003c/a\u003e •\n  \u003ca href=\"#changelog\"\u003eChangelog\u003c/a\u003e •\n  \u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e •\n  \u003ca href=\"#security-vulnerabilities\"\u003eSecurity Vulnerabilities\u003c/a\u003e •\n  \u003ca href=\"#credits\"\u003eCredits\u003c/a\u003e •\n  \u003ca href=\"#Sponsor\"\u003eSponsor\u003c/a\u003e •\n  \u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\n\u003c/p\u003e\n\n## \u003ca id=\"tldr\"\u003e\u003c/a\u003e TL;DR\n\nWant to learn or experiment with different database engines without requiring \nto install additional dependencies? ***Localhost Databases*** is a collection \nof Docker Compose files for relational and NoSQL databases.\n\n#### Quick Start\n\n1. Clone this repository.\n2. The Database Docker Compose files are located in the `databases` folder.\n2. Copy the DotEnv example file to create your DotEnv file and configure your \ndatabase's credentials and settings.\n3. Starting a database Docker container is simple by running the `docker compose up` command.\n\n##### Docker Compose Command:\n\n```bash\n$ docker compose up -d\n```\n\n## About\n\nThis repository is a collection of Docker Compose files for relational and \nNoSQL databases. Which aims to offer a simple approach to setting up databases \nfor a local environment.\n\n**What is the purpose of the database collection?**  \n\nAs a developer, you might be working on multiple Docker-based projects. Your \nprojects could be interacting with each other, e.g., a service mesh. Each \nservice could have its database container with the same database engine.\n\nRunning all the containers locally on your computer could impact performance. \nYou could experience the Docker container port binding failure message - \n*Bind for 0.0.0.0:3306 failed: port is already allocated.* Having a shared \ndatabase container would resolve these issues.\n\nAlso this database collection allows you to learn and experiment with different \ndatabase engines without you installing additional dependencies to use \nthe databases.\n\n## Disclaimer\n\n\u003e [!IMPORTANT]  \n\u003e ***Localhost Databases*** is not affiliated with the databases' \ndevelopers/owners and is not an official product.\n\n***Localhost Databases*** has been developed to run databases in a local \nDocker environment. To install a production instance, read the databases' \nrespective installation guides.\n\n## Getting Started\n\nYou will need to make sure your system meets the following prerequisites:\n\n- Docker Engine \u003e= 20.10.00\n\nThis repository utilizes [Docker](https://www.docker.com/) to run Databases, \ne.g., MySQL. So, before using ***Localhost Databases***, make sure you have \nDocker installed on your system.\n\n## Download\n\nYou can clone the latest version of ***Localhost Databases*** repository for \nmacOS, Linux and Windows.\n\n```bash\n# Clone this repository.\n$ git clone git@github.com:luisaveiro/localhost-databases.git --branch main --single-branch\n```\n\n## How To Use\n\nThere are a few steps you need to follow before you can have a database set up \nand running in Docker container. I have outline the steps you would need to \ntake to get started.\n\n#### 1. \u003cins\u003eConfiguring your DotEnv file\u003c/ins\u003e\n\nBefore you start a database in a Docker container, you will need to create a \nDotEnv file. The DotEnv file will allow you to configure your database's \ncredentials and map a container's port.\n\n***Localhost Databases*** includes a `.env.example` file for each Database. You \ncan run the following command in the terminal to create your DotEnv file.\n\n```bash\n# Navigate to a database.\n$ cd databases/mysql\n\n# Create .env from .env.example.\n$ cp .env.example .env\n```\n\nEach database has its environment variables (below, I have provided more information). \nYou have the option to modify each of the database's environment variables \nindividually.\n\n```ini\n#--------------------------------------------------------------------------\n# Database (MySQL) env\n#--------------------------------------------------------------------------\n\n# The MySQL database container name. | default: mysql_db\nDB_CONTAINER_NAME=\"${APP_NAME}_db\"\n\n# The MySQL database configuration. | default: local\nDB_DATABASE=\"local\"\n\n# The MySQL database root credentials.\nDB_ROOT_PASSWORD=\"\"\n\n# The MySQL database user credentials.\nDB_USERNAME=\"\"\nDB_PASSWORD=\"\"\n\n# Map the database container exposed port to the host port. | default: 3306\nDB_PORT=3306\n```\n\n#### 2. \u003cins\u003eStart database container\u003c/ins\u003e\n\nAfter you configure your DotEnv, you can start a database container. Each \ndatabase has its individual Docker Compose file. You can run the Docker Compose\n`up` command.\n\n```bash\n$ docker compose up -d\n```\n\nAn example of the `docker compose` command would be as follows:\n\n```bash\n# Navigate to a database.\n$ cd databases/redis\n\n# Run Docker Compose command.\n$ docker compose up -d\n```\n\nDocker will create the database container with the container name \n`redis_db` in our example. The container will be attached to a network \ncalled `local_dbs_network`.\n\nIf you want to change the container name or network name, you can edit the \nDotEnv file and override the Docker Compose variables. Below is an example of \nthe DotEnv variables.\n\n```ini\n#--------------------------------------------------------------------------\n# Database (Redis) env\n#--------------------------------------------------------------------------\n\n# The Redis database container name. | default: redis_db\nDB_CONTAINER_NAME=\"redis_db\"\n\n#--------------------------------------------------------------------------\n# Network env\n#--------------------------------------------------------------------------\n\n# The Docker network for the containers. | default: local_dbs_network\nNETWORK_NAME=\"local_dbs_network\"\n```\n\n## Databases\n\nLocalhost Databases include 14 database servers. The following databases are \npart of this repository's collection:\n\n- [Cassandra](databases/cassandra/README.md)\n- [CockroachDB](databases/cockroachdb/README.md)\n- [CouchDB](databases/couchdb/README.md)\n- [DynamoDB Local](databases/dynamodb/README.md)\n- [EdgeDB](databases/edgedb/README.md)\n- [MariaDB](databases/mariadb/README.md)\n- [MongoDB](databases/mongodb/README.md)\n- [Microsoft SQL Server (MSSQL)](databases/mssql/README.md)\n- [MySQL](databases/mysql/README.md)\n- [Neo4j](databases/neo4j/README.md)\n- [PostgreSQL](databases/pgsql/README.md)\n- [Redis](databases/redis/README.md)\n- [SurrealDB](databases/surrealdb/README.md)\n- [YugabyteDB](databases/yugabytedb/README.md)\n\nI have provided a README file for each database on how to configure the database, \nstart the database container and connect to the database via a database client \napp.\n\n---\n\n## Docker Network\n\nIf you wish to attach your Docker containers to the database network to allow \nother containers to access your database. I have outlined the necessary \nconfiguration below both for Docker Compose and Docker CLI approach.\n\nOnce your database container is up and running, you will need to configure your \ncontainers by attaching the **local_dbs_network** network to your container(s).\n\n**Docker Compose**\n\nIn your Docker Compose file you need to define **local_dbs_network** as an \nexternal network. For each services you want to have access to your database \ncontainer, you will need to add **local_dbs_network** as an attached network.\n\n##### **Docker Compose**\n\n```yaml\nversion: '3.8'\n\nservices:\n  backend:\n    container_name: backend\n    image: python:3\n    # (Optional) depends on database container name\n    depends_on:\n      - mongodb\n    # Add local_dbs_network as attached network.\n    networks:\n      - local_dbs_network\n    volumes:\n      - ./:/usr/src/myapp \n    command: [\"python\" \"main.py\"]\n\nnetworks:\n  # Add local_dbs_network as an external network.\n  local_dbs_network:\n    external: true\n```\n\n**Docker CLI**\n\nIf you don't use Docker Compose, I have included an example of Docker CLI to \nstart a container with the necessary configurations.\n\n```bash\n$ docker run --rm -it --name backend --network=local_dbs_network -v \"$PWD\":/usr/src/myapp -w /usr/src/myapp python:3 python main.py\n```\n\n## FAQ\n\n**Q:** Are you planning to add additional databases, e.g., CouchDB \u0026 Cassandra?  \n**A:** I don't have a roadmap for adding additional databases to this repository. \nHowever, you can suggest a database in the \n[Discussion section](https://github.com/luisaveiro/localhost-databases/discussions/categories/ideas) \nand I will try to include the database as part of the repository's database \ncollection.\n\n## Useful Tips\n\n[NoSQL Workbench](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/workbench.html)\nis an Amazon DynamoDB client that provides data modeling, data visualization, \nand query development.\n\n[TablePlus](https://tableplus.com/) is a modern, native tool for database \nmanagement that supports whole set of relational databases (and some NoSQL).\n\n[Postman](https://www.postman.com/) enables you to easily explore, debug, and \ntest your APIs while also enabling you to define complex API requests for HTTP, \nREST, SOAP, GraphQL, and WebSockets.\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nI encourage you to contribute to ***Localhost Databases***! Contributions are \nwhat make the open source community such an amazing place to be learn, inspire, \nand create. Any contributions you make are **greatly appreciated**.\n\nPlease check out the [contributing to Localhost Databases guide](.github/CONTRIBUTING.md) \nfor guidelines about how to proceed.\n\n## Security Vulnerabilities\n\nTrying to report a possible security vulnerability in ***Localhost Databases***? \nPlease check out our [security policy](.github/SECURITY.md) for guidelines \nabout how to proceed.\n\n## Credits\n\nThe illustration used in the project is from [unDraw (created by Katerina Limpitsouni)](https://undraw.co/). \nAll product names, logos, brands, trademarks and registered trademarks are \nproperty of their respective owners.\n\n## Sponsor\n\nDo you like this project? Support it by donating.\n\n\u003ca href=\"https://www.buymeacoffee.com/luisaveiro\"\u003e\n  \u003cimg src=\"./images/bmc-button.svg\" alt=\"Code Review\" width=\"144\"\u003e\n\u003c/a\u003e\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n\n---\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://github.com/luisaveiro\" target=\"_blank\"\u003eGitHub\u003c/a\u003e •\n  \u003ca href=\"https://uk.linkedin.com/in/luisaveiro\" target=\"_blank\"\u003eLinkedIn\u003c/a\u003e •\n  \u003ca href=\"https://twitter.com/luisdeaveiro\" target=\"_blank\"\u003eTwitter\u003c/a\u003e\n\u003c/p\u003e\n","funding_links":["https://github.com/sponsors/luisaveiro","https://www.buymeacoffee.com/luisaveiro"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluisaveiro%2Flocalhost-databases","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluisaveiro%2Flocalhost-databases","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluisaveiro%2Flocalhost-databases/lists"}