Accessing an Already Existed MongoDB Database from Docker

  database, docker, mongodb, spring

I am currently trying to learn Spring, MongoDB, and Docker. I have created a spring application that consists of a REST API. In the API a person can be saved, deleted, or updated, and the last state of the version gets saved in the Person collection of the Person database. The host is local, and the port is 27017.

All of the tutorials that I’ve watched show creating a mongo database using Docker. But I already can access this database in MongoDB Compass or Terminal. How can I access my already existent database from Docker?

Thank you in advance.

Source: Docker Questions