and then run docker ps I can see a list of containers running on the remote host.
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
590f51318d0b gitlab.catalyst.net.nz:4567/myproject-nginx:latest "nginx -g 'daemon of…" About an hour ago Up About an hour 81/tcp docker_web_1
27a5094d9a01 gitlab.catalyst.net.nz:4567myproject-webapp:44405 "pact runserver 0.0.…" About an hour ago Up About an hour 8000/tcp docker_app_1
Expected behaviour
When I run the inventory script I expect to see a list of running containers on the remote host that corresponds to what I see with docker ps. These should be services running the host specified by DOCKER_HOST.
Actual behaviour
I get an empty result
./ansible/inventory/docker_inventory.py --list
{"all": {"hosts": []}, "_meta": {"hostvars": {}}}
I believe it is only looking at the local host and not the remote docker engine. If I start an alpine image locally and run the inventory again I get
I'm using docker-machine to control a number of remote clients. When I change the environment to point to one of the remote docker hosts I manage with
and then run
docker ps
I can see a list of containers running on the remote host.Expected behaviour
When I run the inventory script I expect to see a list of running containers on the remote host that corresponds to what I see with
docker ps
. These should be services running the host specified byDOCKER_HOST
.Actual behaviour
I get an empty result
I believe it is only looking at the local host and not the remote docker engine. If I start an alpine image locally and run the inventory again I get