1

On an up-to-date Ubuntu 15.04 machine with Docker version 1.8.2, build 0a8c2e3.

If I run the standard docker-machine test as instructed here:

$ docker-machine create --driver virtualbox dev
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env dev
$ docker-machine ls
NAME        ACTIVE   DRIVER       STATE     URL                         SWARM
dev                  virtualbox   Running   tcp://192.168.99.101:2376

So it's running, and I can see it in Virtualbox with the correct user and network interfaces.

So I do the next step to "to tell Docker to talk to that machine".

$ eval "$(docker-machine env dev)"

But when I attempt to do a "docker ps", the container does not show:

$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

Why does docker ps not show my docker-machine container?

2

Well that's because you haven't actually started a container yet. You have just created a VM on which the docker server can run.

Running the following just says that the docker command should use the vm you just created. The docker command does not point to a container, but a machine (which is named "dev" in this case).

eval "$(docker-machine env dev)"

You will see the VM you just created by opening up virtualbox.

Now if you want to actually start a container you can try a command like the following:

docker run --name=test_container --rm -it alpine /bin/bash

Open up a new terminal window (while that container is still running) and init your environment again:

eval "$(docker-machine env dev)"

Now if you run docker ps you will see the container that you have running.

| improve this answer | |
  • 1
    I think the mistake here is that the documentation doesn't provide any expected output of docker ps. It just says "For example....docker ps". This implies that there should be some output, since docker ps lists containers I expected the example environment to have a container. – tu-Reinstate Monica-dor duh Sep 14 '15 at 22:59
  • Ah I didn't even bother looking at the documentation as I knew it should not have output yet, however you are correct the documentation seems flawed in this example. This was a bad place for them to put that command. They should have added a simple container first. – Gerry Sep 15 '15 at 1:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.