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:

  • Is it possible to pin the container to a remote machine instead of a new container instance?
  • How to open 3000 port on Amazon EC2 for Docker Container?
  • Nginx proxy on Elastic Beanstalk EC2 instance times out
  • AWS ECS leader commands (django migrate)
  • How to run undertow java app with docker
  • Issue when joining serf nodes located in different Docker containers
  • 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

  • Symfony 3 and Docker (nginx, php7.1-fpm mysql8) Performances low on Windows
  • How to list the container images in the Google Container Registry using java
  • Sporadic (Authentication??) Failures and Expirations in MongoDb
  • Docker Compose: deploying different services from docker-compose.yml to different set of hosts
  • Cannot load c:/php/php5apache2_4.dll into server: The specified module could not be found
  • Files in the folder don't appear on the host after mounting to container
  • 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.