Docker on AWS not running on any port

I’ve built a simple python streamlit app in docker that runs as expected on my local machine when I go to localhost:8880. However, when the container is launched in a Linux EC2 instance I’m unable to to connect to the app.

If I ssh into the EC2 instance and run the command “docker container ls” it shows that the container is up and running, but the “Port” field is blank. As far as I can tell the docker logs do not give any warnings or errors that might explain why Docker is not running on a port in the EC2 instance.

Any help on this would be greatly appreciated!

Results of “docker container ls” on the EC2 instance:

Docker logs on EC2 instance:
[ec2-user@ip-172-31-0-250 ~]$ docker logs ac86
level=info time=2023-07-14T05:36:44Z msg=“Successfully got ECS instance credentials from provider: EC2RoleProvider” module=instancecreds_linux.go
level=info time=2023-07-14T05:36:44Z msg=“Starting Amazon ECS Agent” version=“1.73.1” commit=“8b82dfb7”
level=info time=2023-07-14T05:36:44Z msg=“Loading configuration”
level=info time=2023-07-14T05:36:44Z msg=“Successfully got ECS instance credentials from provider: EC2RoleProvider” module=instancecreds_linux.go
level=info time=2023-07-14T05:36:44Z msg=“Successfully got ECS instance credentials from provider: EC2RoleProvider” module=instancecreds_linux.go
level=info time=2023-07-14T05:36:44Z msg=“Image excluded from cleanup” image=“amazon/amazon-ecs-pause:0.1.0”
level=info time=2023-07-14T05:36:44Z msg=“Image excluded from cleanup” image=“amazon/amazon-ecs-pause:0.1.0”
level=info time=2023-07-14T05:36:44Z msg=“Image excluded from cleanup” image=“amazon/amazon-ecs-agent:latest”
level=info time=2023-07-14T05:36:44Z msg=“Loading state!” module=state_manager.go
level=info time=2023-07-14T05:36:44Z msg=“Event stream ContainerChange start listening…” module=eventstream.go
level=info time=2023-07-14T05:36:44Z msg=“eni watcher has been initialized” module=watcher_linux.go
level=info time=2023-07-14T05:36:49Z msg=“Successfully loaded Appnet agent container tarball: /managed-agents/serviceconnect/ecs-service-connect-agent.interface-v1.tar” image=“ecs-service-connect-agent:interface-v1”
level=info time=2023-07-14T05:36:49Z msg=“Registering Instance with ECS”
level=info time=2023-07-14T05:36:49Z msg=“Remaining mem: 970” module=client.go
level=info time=2023-07-14T05:36:49Z msg=“Registered container instance with cluster!” module=client.go
level=info time=2023-07-14T05:36:49Z msg=“Instance registration completed successfully” cluster=“tuesday_cluster” instanceArn=“arn:aws:ecs:us-east-1:457475046106:container-instance/tuesday_cluster/54d58121a58d4bbdacdbd80d81c2841b”
level=info time=2023-07-14T05:36:49Z msg=“Image excluded from cleanup” image=“ecs-service-connect-agent:interface-v1”
level=info time=2023-07-14T05:36:49Z msg=“Initializing stats engine”
level=info time=2023-07-14T05:36:49Z msg=“Event stream DeregisterContainerInstance start listening…” module=eventstream.go
level=info time=2023-07-14T05:36:49Z msg=“Beginning Polling for updates” module=agent.go
level=info time=2023-07-14T05:36:49Z msg=“Establishing a Websocket connection” url=“https://ecs-t-4.us-east-1.amazonaws.com/ws?agentHash=8b82dfb7&agentVersion=1.73.1&cluster=tuesday_cluster&containerInstance=arn%3Aaws%3Aecs%3Aus-east-1%3A457475046106%3Acontainer-instance%2Ftuesday_cluster%2F54d58121a58d4bbdacdbd80d81c2841b&dockerVersion=20.10.23
level=info time=2023-07-14T05:36:49Z msg=“NO_PROXY is set: 169.254.169.254,169.254.170.2,/var/run/docker.sock”
level=info time=2023-07-14T05:36:49Z msg=“Establishing a Websocket connection” url=“https://ecs-a-4.us-east-1.amazonaws.com/ws?agentHash=8b82dfb7&agentVersion=1.73.1&clusterArn=tuesday_cluster&containerInstanceArn=arn%3Aaws%3Aecs%3Aus-east-1%3A457475046106%3Acontainer-instance%2Ftuesday_cluster%2F54d58121a58d4bbdacdbd80d81c2841b&dockerVersion=DockerVersion%3A+20.10.23&protocolVersion=2&sendCredentials=true&seqNum=1
level=info time=2023-07-14T05:36:49Z msg=“Connected to TCS endpoint” module=handler.go
level=info time=2023-07-14T05:36:49Z msg=“Connected to ACS endpoint” module=acs_handler.go

Maybe you should post the command you executed to start your container or share your docker-compose.yml.