Largely, the answer is “not usually.” Docker has come a long way since its inception, and it isn't a terrible or “wrong” idea to containerize databases anymore. It certainly can be done, and has some benefits to it. However, for most general workloads, the benefits don't outweigh the complications.
Is it a good idea to Containerize database?
If you're working on a small project, and are deploying to a single machine, it's completely okay to run your database in a Docker container. Be sure to mount a volume to make the data persistent, and have backup processes in place. ... It's convenient, and perfectly fine for small projects handling non-crucial data.
When should you Containerize a database?
Containerized databases separate storage from compute, meaning storage performance and capacity can be scaled independently of compute resources. This provides more flexibility in upfront database capacity planning and provisioning, since changes are much easier to make later.