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:

  • Docker + SSL + apache2 + x509
  • How to use a separate file system for the Docker daemon related files at start up on AWS EC2
  • Docker swarm and published port not available
  • Unable to install node 7.5.0
  • cURL to DropBox using Symfony 3
  • How to move Docker containers to AWS
  • docker swarm init --advertise-addr

    and then I tried running this curl command:


    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

  • Start sshd automatically with docker container
  • How to run Karma tests from docker container?
  • Expose container on random port on internal IP
  • Dynamically Pull Docker Image using chef recipe
  • Docker-compose up causing client is newer than server error
  • How can I set up a mysql slave in Docker?
  • 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.