I'm running an out of the box mysql docker container inside docker play ground at https://labs.play-with-docker.com/
[node1] (local) root@192.168.0.8 ~
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f0f8ae352373 mysql "docker-entrypoint.s…" 2 hours ago Up 2 hours 0.0.0.0:3306->3306/tcp, 33060/tcp memories
[node1] (local) root@192.168.0.8 ~
$
Now if I have to connect to this mysql instance from my local machine, it's been suggested to create a SSH tunnel.
This is what I have tried
➜ sqlconnect ✗ ssh -L 3306:192.168.0.8:3306 ip172-18-0-115-c1mf4d0h550g00dlq95g@direct.labs.play-with-docker.com
Enter passphrase for key '/Users/ankitjha/.ssh/id_rsa':
Connecting to 40.87.120.67:8022
###############################################################
# WARNING!!!! #
# This is a sandbox environment. Using personal credentials #
# is HIGHLY! discouraged. Any consequences of doing so are #
# completely the user's responsibilites. #
# #
# The PWD team. #
###############################################################
[node1] (local) root@192.168.0.8 ~
$
When I tried connecting from my sql dbeaver client
This is the error I got
[node1] (local) root@192.168.0.8 ~
$ channel 3: open failed: administratively prohibited: open failed
You can't do this. It's disabled by design. Check https://github.com/play-with-docker/play-with-docker/issues/373#issuecomment-814553922
If you already have a terminal in the environment, why do you want to connect from your PC?