/dbc

Database Container- A CLI to create and manage database containers.

Primary LanguagePythonMIT LicenseMIT

Database Container

Setup development database enviroments with a easy to use database container management tool.

Supported databases

  • MySQL: mysql
  • PostgreSQL: postgres
  • MongoDB: mongo
  • Microsoft SQLServer: mssql
  • Redis: redis

Supported container managers

  • Docker: docker
  • Podman: podman

Dependencies

Setup

How to download and install:

$ git clone https://github.com/Raisess/dbc
$ cd dbc
$ ./install.py
$ dbc help

How to use?

create:

Create a new container and download a new database image if don't have one.

$ dbc create `database-type` `container-name`
  • NOTE: You can use environment variables to set things like password, check how here.

connect:

Enter into the container using a client software, e.g.: psql.

$ dbc connect `database-type` `container-name`
  • NOTE: You don't need to specify the environment variables to connect using the connect command.

enter:

Enter into the container using bash.

$ dbc enter `container-name`

destroy:

Delete the container and the volume, but keeps the database image.

$ dbc destroy `container-name`

Container managers

By default dbc will use docker, to use another container set the CONTAINER environment variable.

E.g.:

$ CONTAINER=podman dbc enter `container-name`

Environment variables

CONTAINER: Specifies the container manager will want to use.

  • Default: docker

DB_NAME: The database name.

  • Default: mydatabase

DB_PORT: The physical port to access the database trough the container.

  • Default: 1234
  • NOTE: Inside the container, the databases will always use they default port, like: 5432 for postgres.

DB_USER: The username to access the database.

  • Default: root

DB_PASS: The database password.

  • Default: mysecretpassword