desktop-linux icon indicating copy to clipboard operation
desktop-linux copied to clipboard

unexpected end of JSON input

Open mohamed-foly opened this issue 3 years ago • 10 comments
trafficstars

image

  • [yes] I have tried with the latest version of Docker Desktop
  • [already disabled] I have tried disabling enabled experimental features
  • [no] I have uploaded Diagnostics

Expected behavior

when open docker desktop supposed to open smoothly

Actual behavior

while using docker command line interface or docker desktop i got error "unexpected end of JSON input"

Information

  • Linux distro: ubuntu
  • Distro version: 20.04.4
  • Docker Desktop Version: 4.11.0

mohamed-foly avatar Aug 10 '22 20:08 mohamed-foly

I found that there is a file in path ~/.docker/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json and it was empty json file, after writing empty json object i got another error so i searched about this file and i copied a dump from documentation example and now it works. I don't know how this file got cleared and what supposed to contain based on my env

image

mohamed-foly avatar Aug 10 '22 20:08 mohamed-foly

@mohamed-foly , would you be willing to share the link to the doc you found?

src-r-r avatar Sep 18 '22 16:09 src-r-r

Thanks so much for posting this! I got my contexting listing again by putting this in:

{
        "Name": "default",
        "Metadata": {
                "StackOrchestrator": "swarm"
        },
        "Endpoints": {
                "docker": {
                        "Host": "unix:///var/run/docker.sock",
                        "SkipTLSVerify": false
                }
        },
        "TLSMaterial": {}
}

archsword avatar Sep 29 '22 07:09 archsword

@mohamed-foly , would you be willing to share the link to the doc you found?

@src-r-r https://docs.docker.com/engine/context/working-with-contexts/#the-anatomy-of-a-context

mohamed-foly avatar Jan 10 '23 11:01 mohamed-foly

Also experienced this issue - the meta.json file described above had become blank, meaning that all docker commands (e.g. docker ps, docker compose) didn't work; and replacing the content of the file as above restores functionality.

drawlinson avatar Jan 29 '23 11:01 drawlinson

Seeing this as well. Seen it empty or no file present. Use a laptop and network frequently changes.

bklooste avatar Feb 05 '23 22:02 bklooste

Same issue with the windows docker desktop: https://github.com/docker/for-win/issues/13180

jeteve avatar Feb 13 '23 10:02 jeteve

How does can I update default context ? I try to find the file path, but unsucessful. SO: Linux Mint

salmomascarenhas avatar Mar 03 '23 00:03 salmomascarenhas

I got the same issue. Here is what I walk-around it. FYI.

  1. Use docker context create dummy to create a new context called dummy
  2. Copy the meta.json content to overwrite the broken one in the context folder
  3. Change the name in that meta.json
  4. Then docker context list will show up all the contexts available
  5. Use docker context rm dummy to remove the dummy one, and it's done.

jiafangtao avatar Mar 07 '23 00:03 jiafangtao

There hasn't been any activity on this issue for a long time. If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale comment. If not, this issue will be closed in 30 days.

Prevent issues from auto-closing with a /lifecycle frozen comment.

/lifecycle stale

docker-robot[bot] avatar Jun 23 '23 01:06 docker-robot[bot]