docker on OSX not returning container output through ssh,

432 views Asked by At

I am running docker (v0.9.0) on OSX 10.9 using boot2docker (v0.6). Everything builds normally. I can use docker normally inside the TinyCore VM. However, within OSX I can issue commands to the docker deamon, but I am not receiving any output. Nor can I retrieve information about containers or processes. For example, I can run from OSX:

docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"

I do get a container ID back, but running docker ps or docker images returns an empty list. If I ssh into TinyCore VM instance and run docker ps, I can see that the container was indeed started and is running, and docker logs returns the 'hello world' log output.

What do I need to do to receive output back to the OSX host?

1

There are 1 answers

0
jpetazzo On BEST ANSWER

The problem comes from the fact that your Docker client (on OS X) is more recent than your server (in the boot2docker VM).

The Docker API uses semantic versioning, so each call is a HTTP request to an URL which looks like this:

/v1.10/containers/create…

The server handles all versions of the API, so if you use an old client (old CLI version, or a program which was designed for an older version of Docker), it will still work properly, because the latest Docker knows how to handle e.g. /v1.3/blahblahblah.

However, if you use a newer client with an older server, it might issue requests for /v1.12/… while the server only knows how to handle up to /v1.10/…. In that case, the server will give you a weird answer, like "Not Found".

This can obviously be confusing :-)

We look forward to the following improvements:

  • the server could recognize the /vXXX pattern, and if XXX is an unsupported version, it could issue an explanatory message;
  • the client could recognize that, and try to fallback to a previous version of the protocol.

Contributions to the Docker project are always welcome; and while the second option might be a bit tricky to implement, the first one should be relatively easy; so this might be a good way to add your name to the Docker contributors list :D