Is it possible to deploy TiDB directly on Docker?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: TiDB直接部署在Docker上是否可以

| username: 18515065291

【TiDB Usage Environment】: Production
【TiDB Version】: 5.0-5.2.2
【Architecture Consultation】:
Question: Can TiDB be directly deployed in Docker?
Can an empty container be directly deployed and TiDB services be deployed using tiup?
Since TiDB needs to be managed using systemctl, Docker super privileges are required, and it needs:
<1> Enable systemd
<2> Add parameters when running Docker: docker run -tid --privileged centos /usr/sbin/init
Is this sufficient?
Will there be any operational issues?

| username: yilong | Original post link

  1. It is not recommended to deploy on Docker. However, if you are considering it, as long as you can ensure that Docker does not have any issues, it should be fine.
  2. Since you are planning to containerize, it would be better to consider public cloud or an operator.
| username: 18515065291 | Original post link

  1. Public cloud is not an option; 58 has a relatively large scale, and currently, we are using a self-built private cloud.
  2. Will tidb-operator continue to be updated? I see that it doesn’t seem to be widely adopted in the industry, and the maintenance approach is relatively complex, requiring DBAs to overturn all current maintenance methods.
  3. Has the official team not tested deploying a standard TiDB in Docker? Using tiup for management.
| username: CuteRay | Original post link

There are many cases of deploying TiDB on private clouds. The most well-known in the community is Xiaomi’s TiDB cluster, which is deployed on k8s and managed using tidb operator.
Column - TiDB’s Implementation and Cloud-Native Exploration at Xiaomi | TiDB Community

【Presentation Materials Download】See How Digital China, Xiaomi, Douyu, and ShardingSphere Play with Open Source Data Architecture - TiDB Community Events / Event Review - TiDB Q&A Community (asktug.com)
This contains the cloud deployment solutions introduced by Xiaomi at that time.

You are already running centos in docker, so there is no difference from running multiple virtual machines to deploy TiDB.

| username: 18515065291 | Original post link

  1. I’ll take a look at Xiaomi.
  2. If deploying empty containers with Docker, using TiUP for management, deploying cluster services, etc., this can achieve isolation while being compatible with the current DBA’s automation. Compared to the complexity of TiDB-Operator, this approach is relatively simple and has a lower maintenance difficulty. Otherwise, reconstructing automation would be quite painful.
| username: xuexiaogang | Original post link

The official documentation for general machines basically allows for one-click deployment. I haven’t used Docker. I feel that the native method is still better. After all, containers are for quick deployment, and the official method has already achieved that. Databases are not like stateless applications such as Tomcat, where it doesn’t matter much. If you can avoid putting the database in a container, it’s better not to.

| username: YuchongXU | Original post link

You can refer to the k8s deployment plan.

| username: YuchongXU | Original post link

Deploy TiDB on Kubernetes | PingCAP Docs