For those who are running DB on different machine, you can do the following:
First, from where the container is, run docker ps to get the containers details including the Container ID
[root@test-001 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1b02333fb3b9 tutum/nginx "/usr/sbin/nginx" 6 weeks ago Up 7 days 0.0.0.0:80->80/tcp docker_nginx_1
8c1d234a3731 mariadb "docker-entrypoint.s…" 6 weeks ago Up 7 days 0.0.0.0:3306->3306/tcp docker_mysql_1
After you get the ID of your database container, run docker inspect CONTAINER_ID to get the related IP address of that container.
[root@test-001 ~]# docker inspect 8c1d234a3731 | grep -i IPAddress
"SecondaryIPAddresses": null,
"IPAddress": "",
"IPAddress": "172.23.0.3",
On Dbeaver, after selecting the DB type on adding new connection window, Go to network settings (SSH, ...) then put your docker machine details. and from the main page, in the Server Host: add the IP you got from the docker inspect command, then your credentials.
This should work