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

  • Dockercloud service stops immediately after start
  • SonarQube server can not be reached by Jenkins using Docker
  • Cannot connect to MySQL server inside Docker
  • RubyMine doesn't see gems from bundle in Docker on Mac OS
  • Open a WebSocket connexion from a docker container to another (able to ping container in cli but not via ws)
  • How can I pull anonymously from docker hub while still having access to a private registry?
  • 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.

  • Mounting private GitHub repository into a pod's volume
  • Running new meteorhacks/meteord application, don't have meteor app
  • docker tool box docker build behind proxy is not working in windows
  • Dockerfile for on and off proxy
  • Kubernetes locally via docker persistence
  • How do I run a docker swarm node on the same machine as the swarm manager?
  • 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.