jesseduffield/lazydocker

Update version execution error: could not determine host context "default" does not exist

xyabc120 opened this issue ยท 14 comments

Describe the bug
After upgrading from v0.21.0 to v0.23.1, executing the lazydocker command resulted in an error :
could not determine host context "default" does not exist
unable to parse docker host ''

To Reproduce

  1. choco upgrade -y lazydocker ๏ผˆThe first installation was done through 'choco install lazydocker'๏ผ‰
  2. lazydocker --version

image

Desktop (please complete the following information):

  • OS: Windows 10
  • Lazydocker Version v0.23.1

Duplicate of #488.

The ~/.docker folder already exists in my directory, and this issue still exists.
I resolved this issue by removing the currentContext attribute from the ~/.docker/config.json file

# set the property value to an empty string
"currentContext": ""
# or remove entire attribute
- "currentContext": "default"

The ~/.docker folder already exists in my directory, and this issue still exists. I resolved this issue by removing the currentContext attribute from the ~/.docker/config.json file

# set the property value to an empty string
"currentContext": ""
# or remove entire attribute
- "currentContext": "default"

This solved the issue for me too! Although it never feels good to delete something without even knowing what it does ๐Ÿ˜… .

I can remove the currentContext and lazydocker starts working again, but I have to do that every time Docker Desktop restarts.

What if you set it to an empty string?

What if you set it to an empty string?

Also when I set it to an empty string.
Docker Desktop resets the currentContext back to the default value when it starts.

I seem to have two Docker contexts:

image

I don't know exactly what these do. I tried removing the desktop-linux context, but that also gets recreated when Docker Deskop restarts.

This is on Windows 11, Docker Desktop 4.25.0 and lazydocker 0.23.1

I've encountered the same issue, and @xyabc120's method helps me for now. Is this the only way to go?

I have the same issue - with ~/.docker/config.json having the line "currentContext": "default", lazydocker will not start.

Setting currentContext to the empty string works around the issue - but then docker-compose won't start:

$ lazydocker --version
Version: 0.23.1
Date: 2023-10-13T07:40:28Z
BuildSource: binaryRelease
Commit: 1060e17731c80372335446eabe6a56ba4facd2b3
OS: linux
Arch: amd64
$ lsb_release --codename
Codename:       jammy
$ docker-compose --version
docker-compose version 1.29.2, build unknown
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 80, in main
    command_func = dispatch()
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 159, in dispatch
    options, handler, command_options = dispatcher.parse(sys.argv[1:])
  File "/usr/lib/python3/dist-packages/compose/cli/docopt_command.py", line 28, in parse
    command_help, options, command = DocoptDispatcher.get_command_and_options(
  File "/usr/lib/python3/dist-packages/compose/cli/docopt_command.py", line 23, in get_command_and_options
    opt = docopt_full_help(command_help, argv, **options)
  File "/usr/lib/python3/dist-packages/compose/cli/docopt_command.py", line 9, in docopt_full_help
    return docopt(docstring, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/docopt.py", line 575, in docopt
    extras(help, version, argv, doc)
  File "/usr/lib/python3/dist-packages/docopt.py", line 485, in extras
    sys.exit()
SystemExit

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 33, in <module>
    sys.exit(load_entry_point('docker-compose==1.29.2', 'console_scripts', 'docker-compose')())
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 129, in main
    exit_with_metrics(command, log_msg=msg, status=status,
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 147, in exit_with_metrics
    MetricsCommand(command, status=status).send_metrics()
  File "/usr/lib/python3/dist-packages/compose/metrics/client.py", line 40, in __init__
    self.context = context_type or ContextAPI.get_current_context().context_type or 'moby'
AttributeError: 'NoneType' object has no attribute 'context_type'
$ docker-compose -p mtproject ps
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 33, in <module>
    sys.exit(load_entry_point('docker-compose==1.29.2', 'console_scripts', 'docker-compose')())
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 81, in main
    command_func()
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 200, in perform_command
    project = project_from_options('.', options)
  File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 60, in project_from_options
    return get_project(
  File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 152, in get_project
    client = get_client(
  File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 41, in get_client
    client = docker_client(
  File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 143, in docker_client
    if not context.is_docker_host():
AttributeError: 'NoneType' object has no attribute 'is_docker_host'

Removing the currentContext completely makes both lazydocker and docker-compose work.

Interestingly, with currentContext set to the empty string, lazydocker works but does not show all docker-compose containers, and for some docker-compose containers it shows the wrong name.

Same issue. Resolved by editing docker config, but that should not be the solution

same issue for me :( removing currentContext mkaes lazydocker work but then it gets its added back when restarting docker desktop.. making it unusable

weirdly if i use "docker context use default" it disappears from the config file and lazydocker works... but still restarting docker adds it back. Something has got twisted here maybe on the docker side.

Also it might be worth noting switching to desktop-linux context also works

As a temporary workaround, I was able to get it to work by specifying the DOCKER_HOST environment variable as DOCKER_HOST="unix:///var/run/docker.sock" lazydocker. (Ubuntu 22.04)