docker / compose

Define and run multi-container applications with Docker
https://docs.docker.com/compose/
Apache License 2.0
33.98k stars 5.23k forks source link

[BUG] docker endpoint for "default" not found #9956

Closed milon27 closed 1 year ago

milon27 commented 2 years ago

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

  1. clone this repo https://github.com/milon27/hello-docker.git
  2. run docker compose up
  3. 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

image

milon27 commented 2 years ago

solved by: reinstalling docker desktop version 4.12.0

pcartwright81 commented 2 years ago

Uninstalling and reinstalling didn't work for me. Also tried removing & installing Hyper-V and WSL which also didn't work.

Pixelao commented 2 years ago

Have exactly the same problem, when trying to launch a project with docker-compose, trigger the message:

docker endpoint for "default" not found

Reinstalling docker desktop version 4.13.0 and still not working.

llslim commented 2 years ago

I am having the same issue after installing docker desktop 4.13.0 on windows

milon27 commented 2 years ago

solved by: reinstalling docker desktop version 4.12.0

nelsonjchen commented 2 years ago

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 of NULs. 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.

llslim commented 2 years ago

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.

nelsonjchen commented 2 years ago

I should clarify that the paths I mentioned are in WSL2's environment. They symlink to the "C:" or /mnt/c pathes.

pcartwright81 commented 2 years ago

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.

nelsonjchen commented 2 years ago

My ~/.docker/contexts/meta/(some sha256)/meta.json was also full of nulls. Deleted it, and restarted the docker service only.

Missing the punchline. Did it work?

pcartwright81 commented 2 years ago

Yes, updated comment.

enjibby commented 2 years ago

@nelsonjchen your workaround is a lifesaver. Thanks!

milas commented 2 years ago

Thanks for the reports - this looks like an issue in Docker Desktop itself (Compose does not handle management of contexts), so I'm closing in favor of docker/for-win#12561.

asghar-mansourian commented 2 years ago

@nelsonjchen thank you for help

sdbondt commented 1 year ago

Just started using Docker and where what how do I find the .docker/contexts files?

pcartwright81 commented 1 year ago

Just started using Docker and where what how do I find the .docker/contexts files?

%userprofile%\.docker\contexts

ismaileveho commented 1 year ago

Solved by adding this to "~/.docker/contexts/meta/(some sha256)/meta.json" {"Name":"desktop-linux","Metadata":{},"Endpoints":{"docker":{"Host":"npipe:////./pipe/dockerDesktopLinuxEngine","SkipTLSVerify":false}}}

wasuaje commented 1 year ago

docker context ls

This worked for me!

AkhilGupta1983 commented 1 year ago

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 of NULs. 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.

Thanks. This worked for me as well

vibhordubey333 commented 1 year ago

For Windows Users

  1. Delete .docker directory. Which exists on PATH C:\Users\your-username\.docker
  2. Restart docker.
iamThiagoo commented 1 year ago

For Windows Users

  1. Delete .docker directory. Which exists on PATH C:\Users\your-username\.docker
  2. Restart docker.

Thanks man, it's works to me!

rreis27 commented 1 year ago

I've tried deleting the .docker directory and restart docker, however it doesn't work and hasn't worked since last year sometime. I should clarify that I'm using this in the context of Visual Studio 2022. I'm running the following:

docker desktop: 4.16.2 (95914) windows 10 Pro: 22H2

maks-rafalko commented 1 year ago

Since I didn't want to remove the whole ~/.docker folder, I removed only ~/.docker/contexts/meta/(some sha256)/meta.json. Solved the issue.

TamilSekar12 commented 1 year ago

Since I didn't want to remove the whole ~/.docker folder, I removed only ~/.docker/contexts/meta/(some sha256)/meta.json. Solved the issue.

@maks-rafalko Solution worked for me. Thanks

Eji4h commented 1 year ago

Since I didn't want to remove the whole ~/.docker folder, I removed only ~/.docker/contexts/meta/(some sha256)/meta.json. Solved the issue.

Thank for you solution. It's worked.

RealMrHex commented 1 year ago

still not fixed! Docker Desktop 4.16.2 (95914) Windows 11 22H2

dionisvl commented 1 year ago

up

yilmazdurmaz commented 1 year ago

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. """

ufedev commented 1 year ago

dockerConfig

disable Docker Compose V2that worked for me and run docker-compose ["whatever"]

malkia commented 1 year ago

Confirmed for me too - had a very old file in %USERPROFILE%.docker\context\\meta.json which was zero bytes, as soon as I've deleted it, docker buildx ls shows now builders!

here is my info: (snipped some stuff at the end)

c:\> docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.10.0)
  compose: Docker Compose (Docker Inc., v2.15.1)
  dev: Docker Dev Environments (Docker Inc., v0.0.5)
  extension: Manages Docker extensions (Docker Inc., v0.2.17)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.23.0)
...
RobLoPresti commented 1 year ago

Ran into ERROR: docker endpoint for "default" not found, solved based on the following https://github.com/docker/compose/issues/9956#issuecomment-1399070673

Since I didn't want to remove the whole ~/.docker folder, I removed only ~/.docker/contexts/meta/(some sha256)/meta.json. Solved the issue.

running on Win11:

> docker buildx ls
ERROR: docker endpoint for "default" not found

> rm -r -force ~\.docker\contexts\meta\

> docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS  BUILDKIT PLATFORMS
default * docker
  default default         running 20.10.22 linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6

> docker --version
Docker version 20.10.22, build 3a2c30b

> docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.10.0)
  compose: Docker Compose (Docker Inc., v2.15.1)
  dev: Docker Dev Environments (Docker Inc., v0.0.5)
  extension: Manages Docker extensions (Docker Inc., v0.2.17)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.23.0)
soondook commented 1 year ago
rm -r -force ~\.docker\contexts\meta\

Thank you! Your solution works! I ran this command and then restart Docker Desktop! docker desktop: 4.16.3 windows 10 Pro: 22H2

qiuyuhz commented 1 year ago

For Windows Users

  1. Delete .docker directory. Which exists on PATH C:\Users\your-username\.docker
  2. Restart docker.

thanks,It worked for me !

yilmazdurmaz commented 1 year ago

People will, someday, learn to use that emoji button to tell us it works without telling us it works.

Zetanova commented 1 year ago

I got this situation multiple times in a row. It looks like that the meta.json 0KB issue is only a secondary error and is produced when docker can't start fully up.

I believe one of the images got corrupted and simply made a break/timeout in multiple internal docker-host components

after clearing the full image store twice it works gain.

barguti commented 1 year ago

disable Docker Compose V2that worked for me and run docker-compose ["whatever"]

This worked for me (version 4.16.3), thanks @ufedev

milas commented 1 year ago

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.

QuAzI commented 1 year ago

Docker Desktop 4.16.3 (96739) Each time when I want to build app in Linux env I have to rm -rf ~\.docker\contexts\meta\ because

$ docker context ls
unexpected end of JSON input
ben-at-soul-refiner commented 1 year ago
docker endpoint for "default" not found

was resolved by deleting ~/.docker/contexts/meta/(some sha256)/meta.json as @nelsonjchen suggested

yilmazdurmaz commented 1 year ago

is it possible to lock the thread, tell people to read workaround solutions given countless times, and emphasize to "open a new report only if none of them works"?

or else, there will be thousands of "thanks, it works" messages in no time.

QuAzI commented 1 year ago

Technically, none of them works for me because it is a pain to do it every 5 minutes

yilmazdurmaz commented 1 year ago

@QuAzI

"it is a pain to do it every 5 minutes".

Hold on there! You are the first one using this narrow interval among the posts I have seen. If you are not kidding around to fetch attention, your story can help identify the problem faster. Why don't you give it a try and spend some time:

QuAzI commented 1 year ago

Almost each time when I change something in app and want to test it in Linux env I have to remove meta as it is empty. So, my each build looks like

> docker-compose up --build
docker endpoint for "default" not found
> wsl
> rm -rf ~/.docker/contexts/meta/
> exit
> docker-compose up --build

Windows 10 Pro 21H2 [Version 10.0.19044.2364] WSL with Ubuntu 22.04.1 LTS (kernel 5.15.79.1-microsoft-standard-WSL2) image

>docker version
Client:
 Cloud integration: v1.0.29
 Version:           20.10.22
 API version:       1.41
 Go version:        go1.18.9
 Git commit:        3a2c30b
 Built:             Thu Dec 15 22:36:18 2022
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.16.3 (96739)
 Engine:
  Version:          20.10.22
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.9
  Git commit:       42c8b31
  Built:            Thu Dec 15 22:26:14 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.14
  GitCommit:        9ba4b250366a5ddde94bb7c9d1def331423aa323
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Even for simple new dotnet app with react with multistage build docker-files.zip

It is also big pain to reinstall different versions as I have a lot of windows containers (stopped while I use Linux env) and rebuild of them can spend a lot of time as docker for win10 doesn't support isolation=process.

QuAzI commented 1 year ago
$ ls -l ~/.docker/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json
-rwxrwxrwx 1 quazi quazi 0 Feb  8 19:42 /home/quazi/.docker/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json

$ docker context ls
unexpected end of JSON input

$ docker network ls
NETWORK ID     NAME      DRIVER    SCOPE
615c37f018ea   bridge    bridge    local
e9d223c049ad   host      host      local
76287cca2804   none      null      local

Looks like docker endpoint for "default" not found means no default network can be created

When docker started fine, I see new network

015517dde602   newwordsdictionary_default   bridge    local
QuAzI commented 1 year ago

Minimal config for dotnet new webapp which also throws problem dotnet new webapp.zip

yilmazdurmaz commented 1 year ago

Ok, hold on again but this time for a misunderstanding. Your details have a few extras to look for such as using both Windows and Linux containers, and Ubuntu 22.04.

But before going on, the folder you should be removing is C:\Users\<yourusername>\.docker\contexts\meta\etc.., not the one inside the WSL. Can you check, with this correction, if you will get the problem this frequently?

QuAzI commented 1 year ago

Interesting... After I removed %USERPROFILE%\.docker\contexts\meta my last minimal test with webapp works fine. But previous test creates empty meta.json again problematic docker-files.zip

nelsonjchen commented 1 year ago

https://serverfault.com/questions/336630/is-there-a-quick-way-to-see-what-filesystem-filter-drivers-are-loaded-on-windows

I'm curious what the output here is. To be honest, I'm no Windows driver developer but this does seem interesting.

QuAzI commented 1 year ago

@nelsonjchen

C:\WINDOWS\system32>fltmc filters

Filter Name                     Num Instances    Altitude    Frame
------------------------------  -------------  ------------  -----
bindflt                                 1       409800         0
FsDepends                              11       407000         0
DwProt                                 11       323610         0
SpiderG3                               11       323600         0
storqosflt                              2       244000         0
wcifs                                   3       189900         0
CldFlt                                  6       180451         0
FileCrypt                               0       141100         0
luafv                                   1       135000         0
npsvctrig                               1        46000         0
Wof                                     8        40700         0
FileInfo                               11        40500         0

C:\WINDOWS\system32>fltmc volumes
Dos Name                        Volume Name                              FileSystem   Status
------------------------------  ---------------------------------------  ----------  --------
                                \Device\Mup                              Remote
D:                              \Device\HarddiskVolume7                  NTFS
C:                              \Device\HarddiskVolume5                  NTFS
                                \Device\NamedPipe                        NamedPipe
                                \Device\Mailslot                         Mailslot
                                \Device\HarddiskVolume3                  FAT
E:                              \Device\HarddiskVolume2                  NTFS
                                \Device\HarddiskVolume6                  NTFS
C:\ProgramData\Microsoft\Windows\Containers\BaseImages\2fd8febc-ccab-468c-a514-3c07da17377e\BaseLayer  \Device\HarddiskVolume10                 NTFS
K:                              \Device\HarddiskVolume33                 FAT
                                \Device\HarddiskVolumeShadowCopy3        NTFS
                                \Device\HarddiskVolumeShadowCopy4        NTFS
                                \Device\HarddiskVolumeShadowCopy5        NTFS
yilmazdurmaz commented 1 year ago

@QuAzI , I tested against having a multi-layer in the build file. I modified it for a sample ASP.NET application. both the build file and compose files worked fine for me. That suggests something else in your system (docker service?) retains that empty meta file and rewrites it back into contexts. try "down" first then "up" again containers created with compose, clearing older images possibly created during your struggles, and restarting the host machine.

PS: not related to the problem at hand, your app is not scalable because of the custom name and single port. keep an eye when deploying ;)