Accessing Docker for Mac via Remote Access API

I’ve been recently experimenting with Docker and I would like to be able to access Docker from within a container in order to run more containers. As I’m experimenting with the platform, I’m running it locally on my Mac, and I am unsure how I would enable the Docker Daemon to be accessed from inside a container.

In order to access the daemon locally, I use the UNIX socket /var/run/docker.sock, however UNIX sockets are not able to be networked, and so I found an article explaining how to enable the Docker Remote Access REST API on Ubuntu ( It explained how I needed to append DOCKER_OPTS='-H tcp:// -H unix:///var/run/docker.sock' to the file /etc/init/docker.conf, however I have been unable to find this file on my Mac.

  • How to remove a mount for existing container?
  • why does the host always response `RST` though the server is listening on the port?
  • Visual Studio 2015 Docker Integration wont attach for debuging
  • Setup Openstack Havana with Docker driver
  • Docker Compose how to extend service with build to use an image instead
  • Propgate changes from base image to “child” image, Docker
  • Any help or directions would be greatly appreciated,


  • kali linux docker image build script failed - syntax error near unexpected token `;&' [closed]
  • When I use Deployment in Kubernetes, what's the differences between apps/v1beta1 and extensions/v1beta1?
  • 'Kubectl' throws error 'failed to negotiate an api version' while installing using docker
  • Celery & RabbitMQ running as docker containers: Received unregistered task of type '…'
  • Private gems are not getting installed in docker
  • Nginx resolving system in Docker container
  • One Solution collect form web for “Accessing Docker for Mac via Remote Access API”

    You need to set a DOCKER_HOST environment variable:

    export DOCKER_HOST='-H unix:///var/run/docker.sock -H tcp://localhost:2376'

    You can create a environment.plist file in ~/Library/LaunchAgents/ to do that at system startup:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
    <plist version="1.0">
    launchctl setenv DOCKER_HOST -H unix:///var/run/docker.sock -H tcp://localhost:2376
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.