无法连接到 Docker 游乐场中的 mysql 服务器 docker 容器 运行

Unable to connect to mysql server docker container running in Docker playground

我是 运行 开箱即用的 mysql docker 容器 docker 游乐场 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 ~
$ 

现在,如果我必须从我的本地机器连接到这个 mysql 实例,建议创建一个 SSH 隧道。

这是我试过的

➜  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 ~
$

当我尝试从我的 sql dbeaver 客户端连接时

这是我得到的错误

[node1] (local) root@192.168.0.8 ~
$ channel 3: open failed: administratively prohibited: open failed

你不能这样做。它被设计禁用。检查 https://github.com/play-with-docker/play-with-docker/issues/373#issuecomment-814553922

如果环境中已有终端,为什么要从 PC 连接?