Note: This setup is intended for local deployment and testing only. Do not use these configurations for production environments.
This repository contains Docker Compose configurations for popular databases. Each database is organized in its own folder with a ready-to-use docker-compose.yml file.
database/
mongodb/
docker-compose.yml
mysql/
docker-compose.yml
postgres/
docker-compose.yml
redis/
docker-compose.yml
scripts/
run-compose.sh
run-compose.bat
test-db/
package.json
test-connections.js
sh scripts/run-compose.sh <service-folder>call scripts\run-compose.bat <service-folder>Replace <service-folder> with one of: mongodb, mysql, postgres, redis.
If you start the postgres service, pgAdmin will also be available for managing your PostgreSQL database.
- Start the PostgreSQL service (see above).
- Open your browser and go to: http://localhost:5050
- Login with:
- Email:
admin@admin.com - Password:
admin123
- Add a new server in pgAdmin:
- Host:
postgres(if inside Docker network) orlocalhost(if connecting from your host) - Port:
5432 - Username:
admin - Password:
password
| Field | Value |
|---|---|
| Name | postgres |
| Host | localhost |
| Port | 5432 |
| Username | admin |
| Password | password |
You can now manage your PostgreSQL database using the pgAdmin web interface.
If you start the redis service, RedisInsight will also be available for managing your Redis database.
- Start the Redis service (see above).
- Open your browser and go to: http://localhost:5540
- In RedisInsight, click Add Redis Database.
- Enter the following connection details:
- Host:
redis - Port:
6379 - Username:
default - Password:
password
- Host:
- Click Test Connection to connect.
- Click Add Redis Database to connect.
| Field | Value |
|---|---|
| Host | redis |
| Port | 6379 |
| Username | default |
| Password | password |
You can now manage your Redis database using the RedisInsight web interface.
If you start the mongodb service, Compass Web will be available for managing your MongoDB database.
- Start the MongoDB service (see above).
- Open your browser and go to: http://localhost:8080
You can now manage your MongoDB database using the Compass Web interface.
If you start the mysql service, phpMyAdmin will be available for managing your MySQL database.
- Start the MySQL service (see above).
- Open your browser and go to: http://localhost:8081
You can now manage your MySQL database using the phpMyAdmin web interface.
To start MySQL:
- Linux/macOS:
sh scripts/run-compose.sh mysql - Windows:
call scripts\run-compose.bat mysql
You can use the Node.js script test-db/test-connections.js to test connections to the running databases.
-
Make sure the target database container is running (see instructions above).
-
Install dependencies:
cd test-db npm install -
Run the test script:
node test-connections.jsOr use the npm scripts defined in test-db/package.json:
npm run test
npm run test:allMongoDB
npm run test:mongodbMySQL
npm run test:mysqlPostgreSQL
npm run test:postgresql
npm run test:postgres # Alias for PostgreSQLRedis
npm run test:redisThe script will attempt to connect to each database and print the result to the console.
- MongoDB
- URI:
mongodb://root:password@localhost:27017 - Sample URI:
mongodb://root:password@localhost:27017/test
- URI:
- MySQL
- Host:
127.0.0.1 - Port:
3306 - User:
root - Password:
password - Sample URI:
mysql://root:password@127.0.0.1:3306/<database-name>
- Host:
- PostgreSQL
- Host:
localhost - Port:
5432 - User:
admin - Password:
password - Sample URI:
postgres://admin:password@localhost:5432/<database-name>
- Host:
- Redis
- Host:
localhost - Port:
6379 - Password:
password - Sample URI:
redis://:password@localhost:6379
- Host:
See the script for details and configuration options.
For instructions on how to install Docker, see the official guide: