How to connect to a docker container from the outside world
I have a web application that is running inside docker container which is running on an Amazon Linux ec2 instance. I would like to connect to that container from the outside world.
How would I do this? I tried using the ec2 instance’s ip address and the port that is exposed, such as:
but this would just give me a 404 error.
I also tried exposing the IP of the ec2 instance at run time, such as:
docker run --name myapplication -p 34.21.331.333:7070:7070
But docker gave me the error:
bind: cannot assign requested address
I am able to connect now, resolved.
One Solution collect form web for “How to connect to a docker container from the outside world”
In EC2, you have to check the security group for your instance and ensure that the port you want is opened to the world.