Database Container Management Made Simple
Installation β’ Quick Start β’ Features β’ Usage β’ Architecture β’ Troubleshooting
As developers, we often face these frustrating scenarios:
- Spending hours configuring database environments across different projects
- Dealing with conflicting versions of databases on our development machines
- Struggling with complex Docker commands for simple database tasks
- Managing database persistence, networking, and tools separately
- Lack of a unified interface for different database systems
- MongoDB "Core Dumped" errors on Debian-based systems that are nearly impossible for beginners to troubleshoot
This last point was a major motivation for creating ContainDB. As a developer working on Debian-based systems, I repeatedly encountered the dreaded "Core Dumped" error when trying to install MongoDB natively. After spending countless hours troubleshooting compatibility issues, library dependencies, and system configurations, I realized there needed to be a better way.
ContainDB was born out of these pain points. I wanted a simple CLI tool that could handle all database container operations with minimal effort, allowing me to focus on actual development rather than environment setup.
ContainDB is an open-source CLI tool that automates the creation, management, and monitoring of containerized databases using Docker. It provides a simple, interactive interface for running popular databases and their management tools without needing to remember complex Docker commands or container configurations.
- π Instant Setup: Get databases running in seconds with sensible defaults
- π Seamless Integration: All databases run on the same Docker network for easy inter-container communication
- πΎ Data Persistence: Optional volume management for data durability
- π Security Controls: Interactive prompts for credentials and access control
- π§© Extensible Design: Support for multiple database types and management tools
- βοΈ Customization: Configure ports, restart policies, and environment variables
- π Management Tools: One-click setup for phpMyAdmin, pgAdmin, RedisInsight, and MongoDB Compass
- π§Ή Easy Cleanup: Simple commands to remove containers, images, and volumes
- π§ Smart Detection: Checks for existing resources to avoid conflicts
- π Auto-Rollback: Automatic cleanup of resources if any errors occur during setup
- π¦ Docker Compose Export: Export your database configurations as a docker-compose.yml file that you can run anytime, anywhere
- π₯ Docker Compose Import: Import and deploy services from existing docker-compose.yml files with automatic conflict resolution
curl -fsSL https://raw.githubusercontent.com/nexoral/ContainDB/main/Scripts/installer.sh | sudo bash -
# Clone the repository
git clone https://github.com/nexoral/ContainDB.git
cd ContainDB
# Build the CLI
./Scripts/BinBuilder.sh
# Build Package (Debian)
./Scripts/PackageBuilder.sh
# Install the package the generated .deb file under the Packages directory
sudo dpkg -i Packages/containDB_*.debRun ContainDB with root privileges:
sudo containDBYou'll be greeted with an attractive banner and a simple menu system that guides you through the process.
| Databases | Management Tools |
|---|---|
| MongoDB | MongoDB Compass |
| MySQL | phpMyAdmin |
| PostgreSQL | pgAdmin |
| MariaDB | (uses phpMyAdmin) |
| Redis | RedisInsight |
sudo containDB
# Select "Install Database"
# Choose your database (e.g., "mongodb")
# Follow the interactive promptsAfter installation, ContainDB provides you with connection details:
β
PostgreSQL started! Access it at http://localhost:5432
Link it to your DB container 'postgresql-container' inside pgAdmin.
π Connection information:
- Container name: postgresql-container
- IP Address: 172.18.0.2
- Port: 5432
π pgAdmin login credentials:
- Email: admin@local.com
- Password: yourpassword
sudo containDB
# Select "Install Database"
# Choose "phpMyAdmin", "PgAdmin", "Redis Insight", or "MongoDB Compass"
# Select the container to manage
# Follow the interactive promptsAfter setting up a Redis container and launching RedisInsight:
- Access the RedisInsight web interface at
http://localhost:8001(or your custom port) - Add a new Redis database connection using:
- Host: Your Redis container name (e.g.,
redis-container) - Port:
6379 - Use the Docker network's built-in DNS to connect automatically
- Host: Your Redis container name (e.g.,
β
RedisInsight started. Access it at: http://localhost:8001
π In the RedisInsight UI, add a Redis database with host: `redis-container`, port: `6379`
(RedisInsight will resolve container name using Docker network DNS.)
sudo containDB
# Select "List Databases" to see running containers
# Select "Remove Database" to stop and remove containers
# Select "Remove Image" to delete Docker images
# Select "Remove Volume" to delete persistent data volumesExport your running databases and management tools as a Docker Compose file:
sudo containDB --exportOr from the interactive menu:
sudo containDB
# Select "Export Services"This creates a docker-compose.yml file in your current directory that you can use to recreate your entire database environment on any system with Docker:
# Move the docker-compose.yml to your project
cp docker-compose.yml /path/to/your/project/
# Run it anywhere
cd /path/to/your/project
docker-compose up -dββββββββββββββββββββββββββββββ βββββββββββββββββββββββ
β ContainDB CLI β β Running Docker β
β (export command) β β Containers β
βββββββββββββββ¬βββββββββββββββ ββββββββββββ¬βββββββββββ
β β
β 1. Identify running containers β
ββββββββββββββββββββββββββββββββββββββββββββ
β
β βββββββββββββββββββββββ
β 2. Inspect container details β Container β
ββββββββββββββββββββββββββββββββββ> Configuration Data β
β βββββββββββββββββββββββ
β
β 3. Extract settings:
β - Image name & tag
β - Container name
β - Port mappings
β - Environment variables
β - Volume mounts
β - Network configuration
β - Restart policies
β - Command overrides
β
βΌ
ββββββββββββββββββββββββββββββ
β docker-compose.yml β βββββββββββββββββββββββ
β Generation β β Local File System β
βββββββββββββββ¬βββββββββββββββ ββββββββββββ¬βββββββββββ
β β
β 4. Write docker-compose.yml file β
βββββββββββββββββββββββββββββββββββββββββββββ
This diagram shows how the ContainDB export feature captures the configuration of your running containers without copying the actual data stored in volumes. The generated docker-compose.yml provides a template for recreating your database infrastructure but requires separate data migration for full restoration.
Import and deploy services from an existing docker-compose.yml file:
sudo containDB --import /path/to/docker-compose.ymlOr from the interactive menu:
sudo containDB
# Select "Import Services"
# Provide the path to your docker-compose.yml fileThis feature analyzes your docker-compose.yml file and deploys all services with proper configuration:
# Example docker-compose.yml import
sudo containDB --import /home/user/my-project/docker-compose.ymlββββββββββββββββββββββββββββββ βββββββββββββββββββββββ
β ContainDB CLI β β docker-compose.yml β
β (import command) β β File β
βββββββββββββββ¬βββββββββββββββ ββββββββββββ¬βββββββββββ
β β
β 1. Read & parse compose file β
ββββββββββββββββββββββββββββββββββββββββββββ
β
β 2. Validate Docker installation
β
β 3. Check for existing services βββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββ>β Running Docker β
β β Containers β
β βββββββββββββββββββββββ
β
β 4. Check for port conflicts βββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββ>β Host System Ports β
β βββββββββββββββββββββββ
β
β 5. Set up volumes βββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββ>β Docker Volumes β
β βββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββ
β Docker Compose Command β βββββββββββββββββββββββ
β Execution β---------------->β Deployed Services β
ββββββββββββββββββββββββββββββ βββββββββββββββββββββββ
This diagram illustrates how ContainDB imports services from a docker-compose.yml file, checking for conflicts and setting up the necessary resources before deploying the services to ensure a smooth integration with your existing environment.
ContainDB follows a layered architecture that separates concerns and promotes code organization.
User Interaction
β
+-------------------------------------------+
| Main CLI Interface |
+-------------------------------------------+
β β
| |
+------------------+ +------------------+
| Base Operations | | Tool Helpers |
+------------------+ +------------------+
β β
| |
+------------------+ +------------------+
| Docker Interface | | System Utilities |
+------------------+ +------------------+
β
Docker Engine & Host System
- Network Creation
ContainDB first ensures that a dedicated Docker network (ContainDB-Network) exists, which allows all containers to communicate with each other using container names as hostnames.
ββββββββββββββββββββββββββββββ creates βββββββββββββββββββββββ
β ContainDB CLI β βββββββββββββββ> Docker Network β
ββββββββββββββββββββββββββββββ βββββββββββββββββββββββ
- Container Orchestration
When you select a database to install, ContainDB:
- Pulls the latest image (if needed)
- Checks for port conflicts
- Sets up necessary volumes for persistence
- Configures environment variables
- Creates and starts the container
ββββββββββββββββββββββββββββββ βββββββββββββββββββββββ
β ContainDB CLI β β Docker Hub β
βββββββββββββββ¬βββββββββββββββ ββββββββββββ¬βββββββββββ
β β
β 1. Pull image β
ββββββββββββββββββββββββββββββββββββββββββββ
β
β 2. Create volume βββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββ> Data Volume β
β βββββββββββββββββββββββ
β
β 3. Run container ββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββ> Database Container β
ββββββββββββββββββββββββ
- Management Tool Integration
For tools like phpMyAdmin, pgAdmin, or MongoDB Compass, ContainDB handles:
- Tool installation and configuration
- Linking to the appropriate database container
- Providing connection details and credentials
ββββββββββββββββββββββββββββββ βββββββββββββββββββββββ
β ContainDB CLI β ββββββββββββββ β Database Container β
ββββββββββββββββββββββββββββββ β βββββββββββββββββββββββ
β
β links
βΌ
βββββββββββββββββββββββ
β Management Tool β
β Container/App |
βββββββββββββββββββββββ
- Auto-Rollback Mechanism
ContainDB implements a robust error handling system that automatically cleans up any partially created resources if something goes wrong:
ββββββββββββββββββββββββββββββ
β Operation Started β
βββββββββββββββ¬βββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββ
β Resource Creation β
βββββββββββββββ¬βββββββββββββββ
β
βΌ
ββββββββ/\ββββββββ
β Error Occurs? β
βββββββββ¬\ββββββββ
β
Yes β βββββββββββββββββββββββ
ββββββββββββββ> Stop Containers β
β βββββββββββ¬ββββββββββββ
β β
β βββββββββββΌββββββββββββ
β β Remove Containers β
β βββββββββββ¬ββββββββββββ
β β
β βββββββββββΌββββββββββββ
β β Clean Temp Files β
β βββββββββββββββββββββββ
β
No βΌ
ββββββββββββββββββββββββββββββ
β Operation Completed β
ββββββββββββββββββββββββββββββ
This ensures your system stays clean even if an operation fails midway, preventing orphaned containers or dangling resources.
ContainDB was created after I found myself repeatedly setting up the same database environments across different projects. The challenges included:
- Remembering specific Docker commands for each database
- Managing network connectivity between containers
- Ensuring data persistence with proper volume configuration
- Setting up administration tools for each database type
The final straw came when I needed to set up a multi-database project that required MongoDB, PostgreSQL, and Redis - all with different configurations, management tools, and persistence requirements. I spent hours on environment setup instead of actual coding.
The MongoDB Crisis: The breaking point was when I tried to deploy MongoDB on a new Debian-based system. Instead of a working database, I got the cryptic "Illegal instruction (core dumped)" error - a common issue on certain Debian systems due to CPU instruction set incompatibilities with pre-built MongoDB binaries. After wasting a full day on troubleshooting this single issue, I realized containerization was the answer.
I realized that these repetitive tasks could be automated, and ContainDB was born. What started as a personal script evolved into a comprehensive tool that I now use daily and want to share with the developer community.
ContainDB has become an essential part of my development workflow by:
- Saving Setup Time: What used to take 30+ minutes now takes seconds
- Standardizing Environments: Ensuring consistent database setups across projects
- Simplifying Management: Providing easy access to admin tools and interfaces
- Isolating Services: Preventing conflicts between different database versions
- Managing Resources: Making cleanup and maintenance straightforward
- Bypassing System Compatibility Issues: Avoiding the notorious MongoDB "core dumped" errors on Debian systems
- Visual Database Management: Quick setup of GUI tools like RedisInsight for better productivity
Real-world example: When working on a new microservice project, I can spin up a PostgreSQL instance, link it to pgAdmin, and have a fully functional development environment in less than a minute - all with proper network configuration and persistence.
| Issue | Solution |
|---|---|
| "Permission Denied" | Ensure you run ContainDB with sudo |
| "Docker Not Found" | Let ContainDB install Docker or run with --install-docker flag |
| "Port Already in Use" | Choose a different port when prompted |
| "Volume Already Exists" | Select to reuse or recreate the volume |
| "Cannot Connect to Database" | Check network settings and credentials |
ContainDB is an open-source project that welcomes contributions from everyone. Here's how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - **Open a Pull Request`
For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
- The Docker team for creating an amazing containerization platform
- The Go community for providing excellent libraries and tools
- Redis Labs for the RedisInsight tool
- All contributors who have helped improve ContainDB
Made with β€οΈ by Ankan Saha
β Star this project β’ π Report Bug β’ β¨ Request Feature