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

  • How to upgrade Docker on Mac from boot2docker version?
  • the docker's host machine cannot connect internet
  • Different images in containers
  • Docker - what exactly is run during starting, number of possible runned processes?
  • Connect to WordPress Docker Container
  • Job for docker.service failed because the control process exited with error code
  • 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?


    EDIT 1:

    I am able to connect now, resolved.

  • Can not access Nodejs app which deployed on container of Bluemix
  • Not able to connect cassandra port 9042 from other machines.
  • Docker development workflow with node.js
  • Docker volume initialization - copying data from image to container
  • Dockerized Mongo takes ages to load then doesn't run mongo
  • Freeing unnecessary Docker image's space
  • 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.