blaise-io / acelink

Play Ace Streams on macOS using Docker.
MIT License
773 stars 50 forks source link

Ace Link does not respect docker contexts #77

Open florius0 opened 10 months ago

florius0 commented 10 months ago

RN docker socket is hardcoded:

https://github.com/blaise-io/acelink/blob/0291aff7f28823b431be8a1b0a0ca2538f9be592/Ace%20Link/Extensions/Process.swift#L21

Which may work for some docker runtimes, tho is not guaranteed to work in the future, or with the default one.

Much better solution would be to fetch the socket URI from user's docker configuration using docker context inspect:

[
    {
        "Name": "orbstack",
        "Metadata": {
            "Description": "OrbStack"
        },
        "Endpoints": {
            "docker": {
                "Host": "unix:///Users/.../.orbstack/run/docker.sock",
                "SkipTLSVerify": false
            }
        },
        "TLSMaterial": {},
        "Storage": {
            "MetadataPath": "/Users/.../.docker/contexts/meta/2d89b732b01a00a2d1675ed3cee9fd0f965daadf90603c989dd3afd4569c6896",
            "TLSPath": "/Users/.../.docker/contexts/tls/2d89b732b01a00a2d1675ed3cee9fd0f965daadf90603c989dd3afd4569c6896"
        }
    }
]

The URI is at [0]Endpoints.docker.host.

Related issues

Solving the problem in the described way will also likely solve the following issues:

Temporary Workaround

At the moment, one could symlink socket of runtime of their choice to ~/.docker/run/docker.sock, i.e. ln -s /Users/.../.orbstack/run/docker.sock ~/.docker/run/docker.sock.

PS I request @blaise-io to pin the issue until fix is implemented, as it contains workaround

blaise-io commented 8 months ago

Note to self for when I pick this up: docker context inspect --format '{{.Endpoints.docker.Host}}'