Get Swarm node IP address from a container using API?

How to get the Swarm node IP address of just created container, using remote API?

  • deploy after gitlab runner completes build
  • How to delete a docker image in dockerhub with a particular tag or set of tags using CLI?
  • Error installing node.js on google compute engine docker image
  • Error running quickstart-camelservlet in OpenShift V3 with Fabric8 and Docker
  • Changing Kafka Configuration on spotify/kafka Dockerfile
  • Can you explain Docker with a practical example/case? [closed]
  • Docker-Machine AWS Policies
  • npm scoped packages and private registry
  • How can you limit which users have Docker exec access in a shared environment?
  • How to properly share a folder between few docker containers in read mode?
  • docker compose: rebuild of one linked container breaks nginx's upstream
  • Make Docker for mac listen on a tcp port
  • One Solution collect form web for “Get Swarm node IP address from a container using API?”

    All relevant container information can be found with docker inspect <your container>.

    The IP of the node your container is running on can be obtained with

    docker inspect --format "{{ .Node.IP }}" <your container>

    Note however, that this might not be the publicly reachable IP address (on an AWS EC2 instance for example, where this would be a private IP).

    To get the hostname and port your swarm masters use to reach the node, use

    docker inspect --format "{{ .Node.Addr }}" <your container>
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.