talos
talos copied to clipboard
`talosctl` should honour Docker Contexts
Bug Report
Description
talosctl does not honour Docker contexts. For example, if the Docker endpoint is non-standard (e.g. when using Colima), then talosctl fails unless DOCKER_ENDPOINT is set.
Logs
$ talosctl cluster create
validating CIDR and reserving IPs
generating PKI and tokens
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Environment
- Talos version:
Client:
Tag: v1.3.6
SHA: 5b6176d8
Built:
Go version: go1.19.7
OS/Arch: darwin/amd64
Server:
NODE: 10.5.0.3
Tag: v1.3.6
SHA: 5b6176d8
Built:
Go version: go1.19.7
OS/Arch: linux/arm64
Enabled: RBAC
NODE: 10.5.0.2
Tag: v1.3.6
SHA: 5b6176d8
Built:
Go version: go1.19.7
OS/Arch: linux/arm64
Enabled: RBAC
- Kubernetes version: N/A
- Platform: Docker
talosctl is using docker client library, so it should work pretty much same way as docker CLI.
I'm not sure if contexts are available in the docker client library, but if they are, it should be an easy fix.
As far as I can tell github.com/docker/docker/client have nothing related to contexts. docker context rely on entire cli implementation, which I don't think we should pull as a dependency. We could copy only relevant parts, but that will require a lot of effort now and in the future to support our fork. Other than that, implementation should be relatively straightforward.
PR's are welcome anyway tho.
@DWSR can you please share with me where you set DOCKER_ENDPOINT? I'm in the same boat of using Colima instead of Docker Desktop but am stuck at the error Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? and am looking for next steps.
I tried export DOCKER_ENDPOINT="$HOME/.colima/docker.sock" but it doesn't work for me... :(
Maybe try ln -s -f /Users/<user>/.docker/run/docker.sock /var/run/docker.sock
as per https://docs.docker.com/desktop/mac/permission-requirements/#installing-symlinks
Instead of adding symlinks, setting the standard DOCKER_HOST environment variable (not DOCKER_ENDPOINT as suggested above) works:
DOCKER_HOST=unix:///$HOME/.colima/default/docker.sock talosctl cluster create
Little snippet I made today to make this work
export DOCKER_HOST=$(docker context inspect $(docker context show) --format '{{ .Endpoints.docker.Host }}')
Since the workaround is quite simple, and changing the behavior will require a lot of new code, which is not going to be used frequently, I think it's safe to say this is not something we will do in the foreseeable future.