use-docker-desktop.sh 950 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. set -e
  3. colima stop
  4. echo "Using docker cli from cask. You may be prompted for your password."
  5. # brew --prefix doesn't seem to apply here - it's just /usr/local
  6. sudo ln -svf /Applications/Docker.app/Contents/Resources/bin/docker "/usr/local/bin/docker"
  7. # this restores the old credsStore value
  8. python3 <<'EOF'
  9. import os
  10. import json
  11. with open(os.path.expanduser("~/.docker/config.json"), "rb") as f:
  12. config = json.loads(f.read())
  13. oldCredsStore = config.get("oldCredsStore")
  14. if oldCredsStore is None:
  15. exit(0)
  16. config["credsStore"] = oldCredsStore
  17. del config["oldCredsStore"]
  18. with open(os.path.expanduser("~/.docker/config.json"), "w") as f:
  19. f.write(json.dumps(config))
  20. EOF
  21. echo "Unlinking colima."
  22. brew unlink colima
  23. echo "Starting Docker."
  24. open -a /Applications/Docker.app --args --unattended
  25. echo "-----------------------------------------------"
  26. echo "All done. Start devservices at your discretion."