Fixing DBLE Docker Deployment: IP Subnet and Permission Issues
This guide walks through troubleshooting DBLE container deployment by adjusting Docker network subnets, correcting DBLE configuration IPs, and granting the necessary database permissions to ensure the logical schema is created without errors.
The author, a senior database expert with over ten years of MySQL experience, explains how to resolve two common problems that arise after installing DBLE (Database Layer Engine) in a Docker environment.
Problems after installing DBLE
IP address mismatch between the Docker image and the DBLE configuration prevents successful initialization.
After changing the IP address, a logical database reports that the administrator lacks permission to create it.
Solution steps
1. Pull the latest DBLE version.
root@ytt-large:/home/ytt# docker image ls | grep -E '^action|^mysql'
mysql 8.0.29 b2500a44757f 8 days ago 524MB
actiontech/dble latest 9988614a8e4b 6 months ago 755MB2. Create a Docker network to connect the backend MySQL instances with DBLE.
root@ytt-large:/home/ytt# docker network create \
-o "com.docker.network.bridge.name"="dble-net" \
--subnet 172.20.0.0/16 dble-net
360a9408c35cd8b8d49ad2e58ca447d5518dbea2d954badc0e618ad5d0c072a13. Launch two MySQL containers (version 8.0.29) with ports 33061 and 33062.
root@ytt-large:/home/ytt# docker run --name backend-mysql1 \
--ip 172.20.0.2 -e MYSQL_ROOT_PASSWORD=123456 \
-p 33061:3306 --network=dble-net \
-d mysql:8.0.29 --server-id=1
54505aeca71ae7c4553a0fa98e705ee302cdfc08c2b472768afc6170dddf6d37
root@ytt-large:/home/ytt# docker run --name backend-mysql2 \
--ip 172.20.0.3 -e MYSQL_ROOT_PASSWORD=123456 \
-p 33062:3306 --network=dble-net \
-d mysql:8.0.29 --server-id=2
5f907b977fc242be35dc01840a5393f2ee754572dd1d59e2fb072032df1ed8d04. After MySQL initializes (≈30 seconds), start the DBLE container.
root@ytt-large:/home/ytt# docker run -d -i -t --name dble-server \
--ip 172.20.0.5 -p 8066:8066 -p 9066:9066 \
--network=dble-net actiontech/dble:latest
df80d0e2451c237afb4792f93e29738579f125288daf0dfee4484ddca83501105. DBLE initialization fails because the IP in db.xml does not match the new subnet.
root@ytt-large:/home/ytt# docker logs dble-server
dble init&start in docker
Starting dble-server...
wait-for-it.sh: waiting 15 seconds for 127.0.0.1:8066
wait-for-it.sh: 127.0.0.1:8066 is available after 6 seconds
init shardingNode and execute template_table.sql
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 104
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
dble init finish6. Edit db.xml inside the container (or copy it out, modify, and copy back) to replace the old IP with the new one, then restart DBLE.
root@ytt-large:/home/ytt# docker exec -it dble-server /bin/bash
[root@df80d0e2451c /]# cat /opt/dble/conf/db.xml | grep 172
root@ytt-large:/home/ytt# docker restart dble-server
dble-server7. A new error appears: the service account lacks permission for logical database testdb2 .
[root@df80d0e2451c ]# dble init&start in docker
Starting dble-server...
wait-for-it.sh: waiting 15 seconds for 127.0.0.1:8066
wait-for-it.sh: 127.0.0.1:8066 is available after 2 seconds
init shardingNode and execute template_table.sql
ERROR 1044 (HY000) at line 200 in file: '/opt/dble/conf/template_table.sql': Access denied for user 'root' to database 'testdb2'
... (other table-not-found errors) ...
dble init finish8. Verify that the root user has sufficient privileges (it does), indicating the logical schema was not added to the DBLE user configuration.
root@ytt-large:/home/ytt# mysql -uroot -p123456 -P8066 -h 127.0.0.1 -e "show grants for root" -s |grep 'CREATE'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE,... ON *.* TO `root`@`%` WITH GRANT OPTION9. Add testdb2 to the user.xml shardingUser definition, then restart DBLE.
[root@df80d0e2451c ~]# cat /opt/dble/conf/user.xml | grep 'testdb2'
root@ytt-large:/home/ytt# docker restart dble-server
dble-server10. After the restart, the logs show no errors.
root@ytt-large:/home/ytt# docker logs dble-server | tail -n 6
Starting dble-server...
Removed stale pid file: /opt/dble/dble.pid
wait-for-it.sh: waiting 15 seconds for 127.0.0.1:8066
wait-for-it.sh: 127.0.0.1:8066 is available after 2 seconds
init shardingNode and execute template_table.sql
dble init finish11. Verify that both logical databases are now present.
root@ytt-large:/home/ytt# mysql -uroot -p123456 -h127.0.0.1 -P8066 -e "show databases"
+----------+
| DATABASE |
+----------+
| testdb |
| testdb2 |
+----------+By aligning the Docker network subnet with DBLE’s configuration files and ensuring the root user’s schema list includes the new logical database, the DBLE container starts cleanly and the logical databases are accessible.
Aikesheng Open Source Community
The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.