use-docker-desktop.sh 722 B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. set -e
  3. colima stop
  4. echo "Using docker cli from cask."
  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