Being a newbie to docker:
Right now I have a java web app running on tomcat, using mysql as database server, and writes to/reads from the filesystem.
Am I supposed to put tomcat, mysql and filesystem resources on different containers (using official tomcat and mysql dockerfiles) and connect them somehow, OR do I write a dockerfile myself that combines everything in a single container?
In the second case should I start with a base dockerfile, say an ubuntu one, and add mysql, java and tomcat to it by copying from their respective official dockerfiles?
You can do either, but your first option is going to be more maintainable and more scalable in the long run.
Composing a service from multiple containers means that you can take advantage of the work other people have already done to create standard images (like the mysql image). It also means that you can independently scale different parts of your application. Need more web front-ends? No problem! Need to use an existing database server or cluster instead of a container? No problem!
A tool like docker-compose will help you maintain an application built from multiple containers.
There are a number of quickstarts (e.g., this one) that might help you get started.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With