Search code examples
dockeramazon-ec2connectivity

No connectivity between EC2 instance and Docker container


I have an EC2 instance (Ubuntu 16.04 ami-ba602bc2) deployed. I've installed docker on it and downloaded a Docker container that runs JasperReports in Tomcat. I've tested this Docker container on my laptop and it works correctly. I downloaded and started the Docker container on the EC2 instance with

docker run -itd -p 8080:8080 dwschulze/jasperreports.server.v7.1.ubuntu.16.04:latest

the same command I use locally to run on my laptop. docker ps shows the container running. I've opened port 8080 in the AWS security group.

I've also connected to the Docker container and verified that the tomcat instance is running.

I can't connect to the reports server from the internet. I've also tried telnet localhost 8080 from the EC2 instance and it times out.

Everything I've read says that I should be able to run a Docker container on an EC2 instance, but it can't even connect locally.

Any ideas?

Thanks.


Solution

  • My problem was that I was running in a t2.small which is too small to even run Tomcat (let alone Jasper Reports) reliably. I switched to a t2.xlarge and problem solved.