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>