'dokerize node node js application

I have a node JS application which i run on EC2.

This app runs fine on EC2 machine and when i do

https://domain-name-of-ec2:3000

It loads the application.

Now i am trying to containerize this application and created a docker file,image and ran container.

It shows container ran success and docker ps shows container running. I used below command

docker run -d image-id -p 3001:3000

Now when i try to load page its done not work.I am using below url

https://domain-name-of-ec2:3001


Solution 1:[1]

Since, you said it works with the port 3000, but with port 3001 its not working, it should be most probably a security group issue, and you will need to change your security group definition attached to the EC2 machine, and add a new entry with

type - Custom TCP,

Port Range - 3001,and

Source - Anywhere-IPv4(or choose otherwise, if there is any restriction), and

Save rules.

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1