Skip to content

Add database mapping port

Allow DB container to expose its port so one can work with GUIs such as MySQL workbench.

That can be done by adding the following to the database service

ports:
      - ${DB_PORT_MAP:-3306:3306}

And then adding ENV variable to .env file DB_PORT_MAP=33066:3306

The above solution will work only for development tasks as in prod we do not want to expose ports Possible solution use Multiple Compose files (for dev an prod) https://docs.docker.com/compose/extends/#example-use-case

Edited by Daniel Garrido