简体   繁体   English

无法使boot2docker端口转发在docker mac os X上工作

[英]Cannot get boot2docker port forwarding to work on docker mac os X

Here is what I have tried: 这是我尝试过的:

My goal: running the prosody XMPP server inside a container, accessed by my (as-yet uncontainerized) local development environment. 我的目标是:在容器中运行prosody XMPP服务器,该容器可由我(尚未进行容器化)本地开发环境访问。

I installed the prosody XMPP server - this is what I am trying to use as a container for local development. 我安装了prosody XMPP服务器-这就是我试图用作本地开发的容器的服务器。

It comes dockerized here: 它在这里被docker化:

https://github.com/lloydwatkin/prosody-docker https://github.com/lloydwatkin/prosody-docker

I ran, as per documentation: 我按照文档运行:

docker run -d prosody/prosody --name prosody -p 5222:5222

I checked prosody was running with docker exec -t -i /bin/bash 我检查了韵律是否正在使用docker exec -t -i /bin/bash

docker ps shows that the container is running, forward to 5222. docker ps显示容器正在运行,前进到5222。

But, on my Mac local shell, telnetting to my boot2docker ip on port 5222 cannot connect. 但是,在我的Mac本地外壳上,无法通过端口5222远程登录到我的boot2docker ip。

I have tried this https://github.com/boot2docker/boot2docker/blob/master/doc/WORKAROUNDS.md 我已经尝试过这个https://github.com/boot2docker/boot2docker/blob/master/doc/WORKAROUNDS.md

but I cannot get that to work. 但我无法解决这个问题。

To add to my confusion, the latest docker.com documentation states port forwarding should work, under Container Port Redirection: 令我感到困惑的是,最新的docker.com文档指出在“容器端口重定向”下,端口转发应该可以工作:

https://docs.docker.com/installation/mac/ https://docs.docker.com/installation/mac/

There was an error in the docker container documentation for prosody. docker容器文档中存在错误。 The correct order of params are: 参数的正确顺序是:

docker run -d --name prosody -p 5222:5222 prosody/prosody

There's no error handling so it was really difficult to identity. 没有错误处理,因此很难识别。

Try running this command in Terminal to forward communication from your local machine's ports 5200 through 5299 to the VirtualBox's ports: 尝试在终端中运行以下命令,将通信从本地计算机的端口5200到5299转发到VirtualBox的端口:

for i in {5200..5299}; do VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port$i,tcp,,$i,,$i”; VBoxManage modifyvm "boot2docker-vm" --natpf1 "udp-port$i,udp,,$i,,$i";done

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM