Can not curl docker swarm from remote host

I’m trying to test how to interact with docker swarm using docker API. I have an ec2 instance in AWS running docker. I need to connect to it from my local machine using curl then initialize the swarm and get the join tokens after to use it to connect 2 other ec2 instances to the swarm. I need to do all of that using curl only.

I created the swarm manually by ssh’ing to the instance and running:

  • Strange behavior of celery workers in ecs docker container
  • EC2 AMI to docker image
  • docker command from the running docker / process
  • Will single docker container scale automatically on Amazon's EC2?
  • Docker-Machine AWS Policies
  • what triggers Elastic Beanstalk to pull in an updated Docker image
  • docker swarm init --advertise-addr 10.0.0.2
    

    and then I tried running this curl command:

    curl 10.0.0.2:2377/swarm
    curl 10.0.0.2:2377/info
    

    and I get an empty line. If I try changing the port to 2376 I get connection refused error.

    What am I missing?

    running netstat -tuplen, found the following result:

    enter image description here

  • Deploy a docker container to production
  • Hashes in `docker pull wordpress`
  • Node Docker Image supporting node --harmony
  • Send request from one docker container to another
  • Docker is changing files ownership and permission, why?
  • What's the best way to share files from Windows to Boot2docker VM
  • One Solution collect form web for “Can not curl docker swarm from remote host”

    To pull the answer out of the comments: By default accessing the remote API has to be done with https authentication. You can turn that off but this isn’t recommended for production apps. There may be a way to write an authorization plugin that will allow other forms of authentication access.

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