简体   繁体   English

Hortonworks HDP docker 如何公开端口

[英]Hortonworks HDP docker how to expose ports publicly

First of all if I am asking a obvious question I apologize in advance.首先,如果我要问一个明显的问题,我会提前道歉。

I am trying to expose Hortonworks HDP docker (version 2.6.5) ports publicly so that the Ambari UI and all the functionality packaged is accessible over the network.我正在尝试公开 Hortonworks HDP docker(版本 2.6.5)端口,以便可以通过网络访问 Ambari UI 和打包的所有功能。 I followed the official documentation everything is installed locally and running, but I cannot access the UI via the browser using the set ports.我遵循官方文档,所有内容都在本地安装并运行,但我无法使用设置的端口通过浏览器访问 UI。

Is there away I can make the docker ports public so it is accessible via the local network?有没有我可以将 docker 端口公开以便可以通过本地网络访问?

I am running the docker image on a Ubuntu 18 machine.我在 Ubuntu 18 机器上运行 docker 映像。

[Update] [更新]

CONTAINER ID        IMAGE                           COMMAND             CREATED             STATUS              PORTS                        NAMES
11b583b0deb5        hortonworks/sandbox-hdp:2.6.5   "/usr/sbin/init"    23 seconds ago      Up 22 seconds       22/tcp, 4200/tcp, 8080/tcp   sandbox-hdp

By default, the Docker containers are not exposed outside the docker host.默认情况下,Docker 容器不会暴露在 docker 主机之外。 In order do expose port X on the host machine and forward traffic to port Y inside the container, use the -p / --publish option when the container is launched.为了在主机上公开端口X并将流量转发到容器内的端口Y ,请在启动容器时使用-p / --publish选项。

I haven't downloaded the sources, but I am more than sure that in the docker-deploy-{HDPversion}.sh script, you must find a docker run... command, which is launching the sandbox-hdp container.我还没有下载源代码,但我非常确定在docker-deploy-{HDPversion}.sh脚本中,您必须找到一个docker run...命令,它正在启动sandbox-hdp容器。 Find and add to that line the publish command.查找并将发布命令添加到该行。

-p 9876:8080

You should then be able to access your container at localhost:9876 .然后,您应该能够在localhost:9876访问您的容器。 You may chose any port you want, that is not in use on the host machine.您可以选择主机上未使用的任何端口。

You can also use the docker option:您还可以使用 docker 选项:
--publish-all Publish all exposed ports to random ports --publish-all 将所有暴露的端口发布到随机端口

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

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