无法通过公共 IP 访问 EC2 上 Docker 中的 Tomcat [英] Can not access Tomcat in Docker on EC2 by public IP
问题描述
我通过命令从 DockerHub 在 AWS EC2 实例上运行 Tomcat 映像
I run Tomcat image on AWS EC2 instance from DockerHub by command
docker run -d -p 8000:8080 tomcat
容器正常启动
ubuntu@ip-172-31-39-118:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cbb1ac139d13 tomcat "catalina.sh run" 21 minutes ago Up 21 minutes 0.0.0.0:8000->8080/tcp vigilant_poitras
我的实例公网IP地址是3.14.3.30我试图通过 Chrome 访问 http://3.14.3.30:8000/
,但访问被拒绝,超时已过期.源和目标的 AWS 安全组设置为 0.0.0.0/0我的 Windows 上的防火墙关闭了.请帮忙解决问题!!
my public IP address of instance is 3.14.3.30
I tried to access http://3.14.3.30:8000/
by Chrome, but access refused, timeout expired.
Security groups in AWS setup to 0.0.0.0/0 for source and destination
Firewall on my Wondows turned off.
Please help to solve problem!!
推荐答案
根据评论,添加的Inbound规则是
According to the comments, Inbound rules added are
22 TCP 0.0.0.0/0 - 这是 ssh 到服务器.
22 TCP 0.0.0.0/0 - This is to ssh to the server.
您还没有打开 8000 端口.打开 8000 端口的入站规则作为 TCP.
You haven't opened the port 8000. Open an inbound rule for port 8000 as TCP.
这篇关于无法通过公共 IP 访问 EC2 上 Docker 中的 Tomcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!