Colima, buildx and docker daemon setup
Hello everyone, this is probably more of a "how to configure Colima properly" rather than an actual issue or maybe it's an issue I am not sure, it is sort of subjective on this one I would say.
Like many people I made the switch to Colima from Docker Desktop and love Colima to pieces but, there is a little thing that is really driving me nuts and I am not sure how to go about it so that it works in a seamless way. The problem has to do with how Colima manages docker contexts and buildx contexts, if I run docker context ls I get the following:
~ docker context ls
NAME DESCRIPTION DOCKER ENDPOINT ERROR
colima * colima unix:///Users/marco.debortoli/.colima/default/docker.sock
default Current DOCKER_HOST based configuration unix:///var/run/docker.sock
All good, nice and clean as I expect it to be. But when I run docker buildx ls I get the following instead:
docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
colima* docker
\_ colima \_ colima running v0.20.0 linux/arm64
default error
Cannot load builder default: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Which again is somehow right because nothing is running on unix:///var/run/docker.sock but it is really gets to my head to see that error. I know that a way to make if work is to set the DOCKER_HOST variable but if I do that then this is what I get running docekr context ls again:
docker context ls
NAME DESCRIPTION DOCKER ENDPOINT ERROR
colima colima unix:///Users/marco.debortoli/.colima/default/docker.sock
default * Current DOCKER_HOST based configuration unix:///Users/marco.debortoli/.colima/default/docker.sock
Warning: DOCKER_HOST environment variable overrides the active context. To use a context, either set the global --context flag, or unset DOCKER_HOST environment variable.
So basically I just move the error to a warning in another place and it also doesn't feel clean/right.
My question then is, what's a clean way to go about this and having Colima work in these scenarios without errors or warning? Thank you for any insight you can provide.
I recently set this in my ~/.zshrc to make sure :
export DOCKER_HOST=$(docker context inspect -f '{{ .Endpoints.docker.Host }}')
And this command works for me:
docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
colima docker
\_ colima \_ colima running v0.17.3 linux/amd64 (+2), linux/arm64, linux/386
default* docker
\_ default \_ default running v0.17.3 linux/amd64 (+2), linux/arm64, linux/386
Source: https://github.com/wagoodman/dive/pull/565#issue-2821757942.
The problem with that approach is that you then get a warning when running:
~ docker context ls
NAME DESCRIPTION DOCKER ENDPOINT ERROR
colima colima unix:///Users/marco.debortoli/.colima/default/docker.sock
default * Current DOCKER_HOST based configuration unix:///Users/marco.debortoli/.colima/default/docker.sock
Warning: DOCKER_HOST environment variable overrides the active context. To use a context, either set the global --context flag, or unset DOCKER_HOST environment variable.
I believe the issue lies is that your default context points to unix:///var/run/docker.sock which iirc is the socket for Docker. Colima creates docker.sock under /Users/<youruser>/.colima/docker.sock. So for me it was enough to actually symlink this socket to /var/run/docker.sock using
sudo ln -s /Users/<youruser>/.colima/docker.sock /var/run/docker.sock
It is more of a warning/info than an error that you can safely ignore.
If you feel uncomfortable with it, you can link to the default docker socket as mentioned here https://github.com/abiosoft/colima/issues/1309#issuecomment-3132174937.
I believe the issue lies is that your default context points to
unix:///var/run/docker.sockwhich iirc is the socket for Docker. Colima creates docker.sock under/Users/<youruser>/.colima/docker.sock. So for me it was enough to actually symlink this socket to/var/run/docker.sockusing
sudo ln -s /Users/<youruser>/.colima/docker.sock /var/run/docker.sock
Well yes, and that's always true. I believe it's hardcoded somewhere even in Colima as far as I remember. I think I read somewhere that symlink the socket could lead to other issues down the road, that's why I didn't do it... I think.
It is more of a warning/info than an error that you can safely ignore.
If you feel uncomfortable with it, you can link to the default docker socket as mentioned here #1309 (comment).
Yes I saw but, as I mentioned I read somewhere it is not recommended. I wonder if it could be worth to have a check on where that socket is even used or present and maybe behave accordingly but at the same time I appreciate it might not be a priority.
I just added the following lines to my .zshrc file to docker buildx ls output without an error or warning:
# Colima - Docker for Mac alternative
# Set the Docker host to use Colima's socket
export DOCKER_HOST="unix://$HOME/.colima/docker/docker.sock"
I'm using at the point of writing the following version of docker-buildx plugin:
> brew info docker-buildx
==> docker-buildx: stable 0.29.1 (bottled), HEAD
Docker CLI plugin for extended build capabilities with BuildKit
https://docs.docker.com/buildx/working-with-buildx/
Installed
/opt/homebrew/Cellar/docker-buildx/0.29.1 (41 files, 66.5MB) *
Poured from bottle using the formulae.brew.sh API on 2025-11-13 at 00:22:06
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/d/docker-buildx.rb
License: Apache-2.0
==> Dependencies
Build: go ✘
==> Options
--HEAD
Install HEAD version
==> Caveats
docker-buildx is a Docker plugin. For Docker to find the plugin, add "cliPluginsExtraDirs" to ~/.docker/config.json:
"cliPluginsExtraDirs": [
"/opt/homebrew/lib/docker/cli-plugins"
]
==> Analytics
install: 3,685 (30 days), 18,552 (90 days), 65,707 (365 days)
install-on-request: 3,681 (30 days), 18,537 (90 days), 65,626 (365 days)
build-error: 1 (30 days)
> cat ~/.docker/config.json
{
"auths": {
"127.0.0.1": { },
},
"cliPluginsExtraDirs": [
"/opt/homebrew/lib/docker/cli-plugins"
],
"currentContext": "colima-docker",
"features": {
"buildkit": "true",
"containerd": "true",
"hooks": "true"
},
"plugins": {
"-x-cli-hints": {
"enabled": "true"
},
"debug": {
"hooks": "exec"
},
"scout": {
"hooks": "pull,buildx build"
}
}
}
I had some issues at first, before the above approach correctly worked, because the default builder always showed an error message without a socket URL/path like unix://....
Here it gets a bit unsharp, because I write down from my memories without verifying my knowledge again, but I hope that my knowledge helps the next person to identify similar issues that are somehow awkward.
What I recognized is that when there is a shell env variable DOCKER_HOST with a value set up, then docker buildx ls uses it but doesn't show an error message that includes a socket URL/path.
-> That indicates that the value of DOCKER_HOST is not correct or the socket is not implementing the Docker API.
When I created a symlink via ln -s like ln -s $HOME/.colima/docker/docker.sock /var/run/docker.sock then docker buildx ls showed me still an issue with the default builder, with an error message that didn't include the URL/path to the socket.
-> I removed the /var/run/docker.sock file/symlink.
- Then I stopped all Colima profiles via:
colima stop(profile:defaultwhich is runtime:incus) andcolima stop --profile docker(profiledockerwhich is runtimedocker).
- Ensured that
.zshrchas not aexport DOCKER_HOST="..."defined, which sets up the ENV variable. - Opened a new “terminal-tab”/“zsh-session”:
- Then I started all Colima profiles via:
colima start(profile:defaultwhich is runtime:incus) andcolima start --profile docker(profiledockerwhich is runtimedocker).
docker buildx lsto check if I still have an error with thedefaultbuilder, which should be, but now we should see an error message with the socket URL/path included.export DOCKER_HOST="unix://$HOME/.colima/docker/docker.sock"docker buildx lsto check if I still have an error with thedefaultbuilder, which shouldn't be anymore; now we shouldn't see any error or warning message; thedefaultbuilder should be shown without an error.- Then I added
export DOCKER_HOST="unix://$HOME/.colima/docker/docker.sock"to my.zshrcfile to resolve the issue permanently.
- Then I started all Colima profiles via:
> docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
colima-docker docker
\_ colima-docker \_ colima-docker running v0.24.0 linux/amd64 (+2), linux/arm64, linux/386
default* docker
\_ default \_ default running v0.24.0 linux/amd64 (+2), linux/arm64, linux/386
Sure, but that doesn't solve the other issue of docker context ls showing the warning instead.