No / var / run / docker.sock on OS X

I am trying to use REST calls to access Docker information. I tried this example, I shot the website:

echo -e "GET /images/json HTTP/1.0\r\n" | nc -U /var/run/docker.sock

      

I didn't get any errors, but nothing happened. I have docker files on my system (I can do "docker images" and view the list). I have no problem with command line command line tools.

Looking at the filesystem, there is no /var/run/docker.sock on my system.

I am using the built-in boot2docker installation on OS X. The output Dockerfile is located here:

bash-3.2$ docker info
Containers: 6
Images: 174
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Dirs: 186
Execution Driver: native-0.2
Kernel Version: 3.16.7-tinycore64
Operating System: Boot2Docker 1.3.2 (TCL 5.4); master : 495c19a - Mon Nov 24 20:40:58 UTC 2014
Debug mode (server): true
Debug mode (client): false
Fds: 11
Goroutines: 13
EventsListeners: 0
Init Path: /usr/local/bin/docker

      

What am I missing?

+3


source to share


1 answer


Docker only works with 64-bit Linux kernels. If you are using boot2docker you are actually talking about installing Docker inside a VM. The Docker client (on your Mac) actually makes REST calls over TLS to the Docker daemon inside the VM.

Since your Docker daemon is already configured to do TLS, you don't need to use the nc

socket talk trick , we can just use curl directly. Unfortunately, the version of curl installed on the Mac does not support the type of certificate used in boot2docker, so you need to create a new certificate first:

$ cd ~/.boot2docker/certs/boot2docker-vm/
$ openssl pkcs12 -export -inkey key.pem \
         -in cert.pem -name b2d-client-side \
         -out b2d-client-side.p12 \
         -password pass:tcuser

      



This should create a file b2d-client-side.p12

. (I took these instructions from https://github.com/boot2docker/boot2docker/issues/573 ). Now we can use curl:

$ curl \
     --cacert ~/.boot2docker/certs/boot2docker-vm/ca.pem \
     --cert ~/.boot2docker/certs/boot2docker-vm/b2d-client-side.p12:tcuser  \
     https://$(boot2docker ip):2376/images/json
[{"Created":1432076009,"Id":"b96d1548a24e2a089512da28da79ce70825f6d7f"....

      

+2


source







All Articles