Docker Community Forums

Share and learn in the Docker community.

How can I know which docker host my CLI returned the information from?

docker

(Arush Salil) #1

Scenario: I have 2 docker daemons listening on separate unix socket and TCP socket.

Question: If I run a command, say docker service ls then how can I know which docker host my CLI returned the information from?


(Sam) #2

docker service ls must be run ON the swarm manager node… not the participants of the swarm.


(Arush Salil) #3

@sdetweil Thank you for the reply, but what if I am remotely connecting to another swarm manager from a host which itself is a swarm manager(and listening on both unix:// and tcp:// socket). How to know which docker swarm manager the CLI is connecting to?


(Sam) #4

define remotely connecting…


(Think) #5

is this a question a docker cli should answer. i would suggest, that this is a responsibility of your surrounding (bash) script? just read the DOCKER_HOST-environment before or after your command.


(Arush Salil) #6

@think @sdetweil Thank you will do the suggested :slight_smile: