Skip to content

Instantly share code, notes, and snippets.

@espoelstra
Last active April 2, 2019 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save espoelstra/17ceab0e8a870b6c311c5ddb36c7a876 to your computer and use it in GitHub Desktop.
Save espoelstra/17ceab0e8a870b6c311c5ddb36c7a876 to your computer and use it in GitHub Desktop.
Azure DevOps Docker for Mac installation
pool:
vmImage: 'macOS-10.13'
steps:
- bash: |
brew cask install docker # grabs Docker for Mac
set -x
echo "Running xattr" # I think brew is supposed to do this but I was still prompted to "trust" it if I didn't
xattr -d -r com.apple.quarantine /Applications/Docker.app
echo "Running Docker as root to install helpers"
echo "All docker/docker-compose commands will require 'sudo' due to the above requirement"
sudo -b /Applications/Docker.app/Contents/MacOS/Docker # -b puts it into the background so this script can continue
echo "Taking a break..."
sleep 15 # This could be improved by using osascript to wait for a Docker window instead
echo "Hit next on startup wizard"
echo "osascript interactions may break in future macOS versions like Mojave if the Accessibility permissions aren't enabled"
osascript -s o -e 'tell application "Docker"' -e 'activate' -e 'tell application "System Events" to key code 36' -e 'end tell'
echo "Wait for docker system info to respond"
set +x
sleep 5
while ! sudo /Applications/Docker.app/Contents/Resources/bin/docker system info > /dev/null 2>&1; do sleep 1; done;
echo "Docker is ready and available"
set -x
sudo docker ps
# Note that opening the app to "complete" the installation creates the system-wide symlinks
ls -lA /usr/local/bin/docker* /var/run/docker*
sleep 1
sudo docker system info
echo "Docker install complete"
- script: sudo docker run --rm hello-world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment