简体   繁体   English

在Docker容器中从外部访问Node.JS应用

[英]External access to Node.JS app, within Docker container

i have a Node app running within a Docker container, hosted on Elastic Beanstalk (single instance). 我有一个在Elastic Beanstalk(单个实例)上托管的Docker容器中运行的Node应用程序。 The docker has port 3000 exposed to access the app within the docker, and I can 'curl 172.17.0.32:3000/test' from the host which returns the expected response. 泊坞窗具有暴露的端口3000,可以访问泊坞窗内的应用程序,我可以从主机“ curl 172.17.0.32:3000/test”中返回预期的响应。

The problem I have is accessing this port externally using the elastic beanstalk url. 我遇到的问题是使用弹性beantalk URL从外部访问此端口。 ie

http://XXXXXX-env.elasticbeanstalk.com:3000/test http://XXXXXX-env.elasticbeanstalk.com:3000/test

This will time out.. can anyone recommend how to gain access to this port externally? 这将超时。.任何人都可以推荐如何从外部访问此端口?

thanks 谢谢

Check this for reference http://victorlin.me/posts/2014/11/26/running-docker-with-aws-elastic-beanstalk 检查一下以供参考http://victorlin.me/posts/2014/11/26/running-docker-with-aws-elastic-beanstalk

see what your docker ps command returns. 查看您的docker ps命令返回什么。

The ip you have shared looks like private ip address of the docker service used for internal network. 您共享的IP看起来像用于内部网络的docker服务的私有IP地址。 You have to enable a bridge between your host and docker container by supplying -p 3000:3000 to the run command and finally enable the app in your elastic console. 您必须通过向run命令提供-p 3000:3000来启用主机和Docker容器之间的桥梁,并最终在弹性控制台中启用该应用程序。

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

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