For development purposes, I have made it my good practice that I have such a folder structure:
Basically the dbstart.sh script contains something like this:
podman run \
-e POSTGRES_USER=xxxxxxx \
-e POSTGRES_PASSWORD=yyyyyy \
--mount type=bind,source=./data,target=/var/lib/postgresql/data \
-p 5432:5432 \
--name postgresProjectName \
So, the data folder is mapped to the data folder inside the container, and the container is a throwaway one, everything that is needed is in the data folder. Of course postgres is similarly configured inside the container to have everything in the data folder. For example the log files will be in data/log.
Using similar setup for MariaDB.
Similar to this, the webstart.sh script may look like this:
podman run \
--mount type=bind,source=./htdocs,target=/usr/local/tomcat/webapps \
-p 8080:8080 \
--name tomcatProjectName \
Then you can even have many database servers and instances in separate folders and containers and many web server instances for separate modules of your application so that they not confict each other, just map them at different ports. You can then start which ones you need and keep the other off.
I should stress again, that this is for development purposes only.