Dockerode: listContainers shows no containers when one present

Created on 25 Mar 2016  Â·  2Comments  Â·  Source: apocas/dockerode

I'm running the following simple code:

var Docker = require('dockerode');
var docker = new Docker();
docker.listContainers(console.log);

and getting the following:

eval `docker-machine env` && node index.js
null []

I've got the following one container running:

docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
default   -        virtualbox   Running   tcp://192.168.99.100:2376           v1.10.3

Am I missing something?

extra info:

➜  test  docker-machine --version
docker-machine version 0.6.0, build e27fb87
➜  test  docker --version
Docker version 1.10.3, build 20f81dd

Most helpful comment

I see. Noob mistake. docker-machine manages the virtualbox machines docker uses to run containers on the mac. docker ps is what listContainers is doing and I was getting an empty list because it defaults to {all: false}.

I would think a saner default would be to have listContainers default to what docker ps defaults to, which is to show all - but you've got a backward compat problem now.

Note that this stuff was not apparent to a first time user.

All 2 comments

This persists after a restart.

I see. Noob mistake. docker-machine manages the virtualbox machines docker uses to run containers on the mac. docker ps is what listContainers is doing and I was getting an empty list because it defaults to {all: false}.

I would think a saner default would be to have listContainers default to what docker ps defaults to, which is to show all - but you've got a backward compat problem now.

Note that this stuff was not apparent to a first time user.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nuest picture nuest  Â·  3Comments

AlexanderCollins picture AlexanderCollins  Â·  5Comments

stanleygu picture stanleygu  Â·  4Comments

mhemrg picture mhemrg  Â·  4Comments

jankeromnes picture jankeromnes  Â·  5Comments