karliwson
karliwson

Reputation: 3485

Create a Docker container with MySQL/MariaDB database

I'm planning to migrate my application stack to Docker. Let me describe the services I'm currently using:

My question is about the database.

What's the proper way of running MariaDB in this case?

  1. Install and run it inside my container, along with the other services?
  2. Run the official image in a separate container, and link my container to it with the --link option of Docker's run command?

Does the first option have any disadvantage?

TeamSpeak docker container uses the second option and that's what made me question myself about the correct way of running the database in my case, but I particularly feel more inclined to package all the services inside my own image.

Upvotes: 0

Views: 610

Answers (1)

Farhad Farahi
Farhad Farahi

Reputation: 39507

Docker Philosophy: Split your application into microservices and use a container for each microservice.

In your case, I recommend a MariaDB container, Using official (Library) Image gives you easier update management, but feel free to use your custom image.

An HAProxy Container, A nginx container and a nodejs container.

This way you divided your application into microservices, and you can upgrade, manage and troubleshoot them easier in an isolated environment.

If you are thinking about delivering your application to end users via docker, a simple docker-compose file will do the trick for easy launching the required containers.

Upvotes: 5

Related Questions