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: 34.21.331.333:7070

  • Docker TLS Error on Ubuntu
  • Running the index structure creator command in an Elasticsearch Docker
  • Dockerized selenium browser cannot access Capybara test url
  • How to use rolling update to re-pull container image?
  • Why can't I pipe a file to “tar” from “curl” with a Docker image for Debian?
  • How to deploy Apache Solr 5x into the Jelastic cloud?
  • 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

    Any ideas?

    Thanks

    EDIT 1:

    I am able to connect now, resolved.

  • Cannot Access Docker Phpmyadmin via Port
  • Python console within Pycharm in a Ubuntu Virtualbox fails to connect
  • installing a GCC compiler onto a Docker Container
  • Webpack Incomplete Chunk Encoding in Chrome
  • mongoDB multiple instances or multiple databases
  • how should microservices talk to each other in docker
  • 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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.