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?
From the docker CLI, you need to use the -H option in order to specify the socket you want docker to talk to.
Or you can set the environment variable DOCKER_HOST (Daemon socket to connect to).
If docker service ls is working, that means that variable was set. Its value would indicate to which docker daemon it is talking to.