compose: [BUG] docker endpoint for "default" not found
Description
when building Dockefile with docker compose
docker compose build
got this error docker endpoint for “default” not found but if i try to build with a remote docker image compose works fine.
github repo: https://github.com/milon27/hello-docker.git
Steps To Reproduce
- clone this repo https://github.com/milon27/hello-docker.git
- run
docker compose up
- you should get docker endpoint for “default” not found this error
os: windows 10 docker desktop version: 4.13.0
note: it was fine when I update the docker desktop to the latest version this problem started.
Compose Version
Docker Compose version v2.12.0
Docker Environment
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., v0.9.1)
compose: Docker Compose (Docker Inc., v2.12.0)
dev: Docker Dev Environments (Docker Inc., v0.0.3)
extension: Manages Docker extensions (Docker Inc., v0.2.13)
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
scan: Docker Scan (Docker Inc., v0.21.0)
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 20.10.20
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc version: v1.1.4-0-g5fd4c4d
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 5.10.16.3-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 6
Total Memory: 12.39GiB
Name: docker-desktop
ID: P4Q6:4LDD:2OTW:O7QR:GYH5:4O4W:BHM6:XK5R:33DQ:AYA5:SMX7:WBHK
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5000
127.0.0.0/8
Live Restore Enabled: false
WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
Anything else?
Error screenshot
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 6
- Comments: 66 (5 by maintainers)
docker context ls
returns:invalid character '\x00' looking for beginning of value
Traced it up to
~/.docker/contexts/meta/(some sha256)/meta.json
.meta.json
was just full ofNUL
s. Deleted it, restarted Docker, and Docker 4.13.0 started working again.meta.json
now has JSON.Can build again.
So, a workaround, but bug wasn’t exactly solved.
For Windows Users
.docker
directory. Which exists on PATHC:\Users\your-username\.docker
My
~/.docker/contexts/meta/(some sha256)/meta.json
was also full of nulls. Deleted it, and restarted the docker service only. I was able to docker compose without issue.solved by: reinstalling docker desktop version 4.12.0
Since I didn’t want to remove the whole
~/.docker
folder, I removed only~/.docker/contexts/meta/(some sha256)/meta.json
. Solved the issue.solved by: reinstalling docker desktop version 4.12.0
Using @nelsonjchen workaround as a guide to my own solution.
On my Windows 10 machine machine, ‘docker context ls’ returns: ‘too many redirects’.
the ~/ .docker/contexts directory is non-existent.
I renamed the ~/.docker directory to something elsse (i.e. ~/.docker-old) and restarted docker.
Everything works.
still not fixed! Docker Desktop 4.16.2 (95914) Windows 11 22H2
Missing the punchline. Did it work?
Solved by adding this to “~/.docker/contexts/meta/(some sha256)/meta.json”
{"Name":"desktop-linux","Metadata":{},"Endpoints":{"docker":{"Host":"npipe:////./pipe/dockerDesktopLinuxEngine","SkipTLSVerify":false}}}
%userprofile%\.docker\contexts
Docker Desktop 4.17 has been released and includes a fix for this 🥳
We do a staged rollout of new releases, so you might not receive a prompt for the in-app update immediately, but you can always click “Check for Updates” in settings or download the latest version manually
Thanks for everyone’s patience, bug reports, and sharing of workarounds in the meantime!
We are aware this is affecting a lot of Compose + Docker Desktop users so are reopening this issue for tracking and visibility.
Internally, we are working on this and will provide an update with the resolution once available. Thanks for your continued patience!
Thanks to everyone who has posted workarounds so far. If one is working for you, please use the GitHub 👍 reaction on the comment to leave a signal for others.
@nelsonjchen your workaround is a lifesaver. Thanks!
Docker Desktop 4.17+ has fixes around this. If you see it after upgrading, manually clean the file (as mentioned ⬆️ @
%USERPROFILE%\.docker\contexts\meta
).Technically, none of them works for me because it is a pain to do it every 5 minutes
was resolved by deleting
~/.docker/contexts/meta/(some sha256)/meta.json
as @nelsonjchen suggestedDocker Desktop 4.16.3 (96739) Each time when I want to build app in Linux env I have to
rm -rf ~\.docker\contexts\meta\
becausedisable Docker Compose V2that worked for me and run docker-compose [“whatever”]
Hi @milon27, Your post’s title attracts attention, but the discussion seems to get longer over time. I suggest you add a TLDR at the top of your first post. You may compose your own or use this:
“”" TL;DR: It turns out this error is caused by one or more broken docker “contexts” after an update, which is tracked in another issue. A quick solution is to remove these broken contexts that reside in
%userprofile%\.docker\contexts
. be careful as this includes “deleting” things from your computer. “”"Thanks man, it’s works to me!
Yes, updated comment.
Uninstalling and reinstalling didn’t work for me. Also tried removing & installing Hyper-V and WSL which also didn’t work.
Hi @dallenbaldwin, The issue was solved since v4.17, but it is possible someone broke the fix. Please first check a few things:
docker context ls
first, check the discussion for the resulting error.Check the answers here, specificaly my messages as I tried to summarize possible solutions as much as possible. The discussion is long, but keep your patience as it may possibly solve your issue.
If all fails, we may have a new issue at hand. Then
Ok, it turns out I was running WSL 2 with a custom kernel to debug
Cilium
, which somehow became incompatible with Docker?So I remove the custom kernel from the
.wslconfig
file, restarted WSL and now I am able to use Docker Desktopv4.17.1
Thanks for the assistance. Case closed.
Hi @maietta , Reinstalling sometimes solves problems, but only sometimes. So it still keeps staying in possible solutions, and worth to give a shot.
Anyways, as you noticed, the problem is those broken meta files that exist even after an update/reinstall process. Developers put lots of effort into it and this should not occur in 4.17 and onwards.
However, it is still possible the update cannot clean up all currently broken files, so the main solution is to find broken context files under
%USERPROFILE%\.docker\contexts\meta
and remove them or replace them from the backup if any.Good Luck 😉
@nelsonjchen
People will, someday, learn to use that emoji button to tell us it works without telling us it works.
Ran into
ERROR: docker endpoint for "default" not found
, solved _based on the following https://github.com/docker/compose/issues/9956#issuecomment-1399070673_running on Win11:
Just started using Docker and where what how do I find the .docker/contexts files?