container-diff
container-diff copied to clipboard
Respect `docker context`
Expected behavior
$ container-diff analyze daemon://alpine:latest
-----Size-----
Analysis for alpine:latest:
IMAGE DIGEST SIZE
alpine:latest sha256:aea8c02625caa3b34db828bd3c308230aa173150e3c976a669bdba561225b72c 7M
Actual behavior
$ container-diff analyze daemon://alpine:latest
ERRO[0000] error retrieving image daemon://alpine:latest: retrieving image from daemon: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Information
- container-diff version:
0.17.0 built from git (unknown)- (from
brew install container-diff
- (from
- Operating system: macOS Sonoma
Steps to reproduce the behavior
- Given that I have these "Docker contexts":
$ docker context ls
NAME TYPE DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR
default moby Current DOCKER_HOST based configuration unix:///var/run/docker.sock
desktop-linux * moby Docker Desktop unix:///Users/vs/.docker/run
- ...and my
defaultdoesn't work:
$ docker --context default ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
- ...but my
desktop-linux(from Docker Desktop for Mac) works:
$docker --context desktop-linux ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
- And
desktop-linuxis my current one:
$ docker context show
desktop-linux
container-diffshould use the current context.
Workarounds
Setting DOCKER_HOST manually works for now:
$ DOCKER_HOST="tcp://0.0.0.0:2375" container-diff analyze daemon://alpine:latest
-----Size-----
Analysis for alpine:latest:
IMAGE DIGEST SIZE
alpine:latest sha256:aea8c02625caa3b34db828bd3c308230aa173150e3c976a669bdba561225b72c 7M
I found another workaround for this: changing (Docker for Mac's config) back from the new default into the older default socket path, as per:
- https://docs.docker.com/desktop/mac/permission-requirements/#installing-symlinks