Multiple databases inside localhost connection

  docker

I’m new to Docker, using it only for local development, and I’m trying to move from MAMP Pro setup to containers for the portability and ease of setup.

One main problem I can’t seem to figure out is how to have multiple databases inside my localhost connection like seen here in Navicat:

Databases under MAMP

In this example db1 is used by project1, and db2 and db3 are both used by another project2

If I try to make containers in Docker for these projects I have to create a different localhost connection for each one (each with different ports), different volumes (probably) and keep track for the settings for each new database that I need.

Is this pattern of single-connection/multiple-databases doable in Docker?
The closest I’ve seen is using a reverse proxy so that everything points to a single port, but I couldn’t make it work with multiple projects. :/

Am I missing something obvious?

Source: Docker Questions

LEAVE A COMMENT