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 (http://www.virtuallyghetto.com/2014/07/quick-tip-how-to-enable-docker-remote-api.html). It explained how I needed to append DOCKER_OPTS='-H tcp://0.0.0.0:4243 -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 can I diagnose issue with Oracle Data Pump import failing with error 1089
  • Copy log files from Docker container to host after CMD is run
  • Docker cloud: weave cannot join the network
  • Kubernetes Limits (1.2) not enforced
  • Kafka On Docker without docker-compose?
  • Docker named volume not updating
  • Any help or directions would be greatly appreciated,

    Cheers

  • Build docker behind VPN
  • Docker ubuntu 16.04 container 64-bit run 32-bit applications
  • On Docker for Mac what would be the host ip as seen from the container? [duplicate]
  • disable interactive mode in docker
  • How to clone and customise laravel homestead and install more things in it?
  • How do you know that public Docker images are secure?
  • 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" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
      <key>Label</key>
      <string>my.startup</string>
      <key>ProgramArguments</key>
      <array>
        <string>sh</string>
        <string>-c</string>
        <string>
    launchctl setenv DOCKER_HOST -H unix:///var/run/docker.sock -H tcp://localhost:2376
        </string>
      </array>
      <key>RunAtLoad</key>
      <true/>
    </dict>
    </plist>
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.