Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ownicn opened this issue Oct 24, 2023 · 18 comments
Labels
bug Something isn't working

Comments

@ownicn
Copy link

ownicn commented Oct 24, 2023

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
@ownicn ownicn added the bug Something isn't working label Oct 24, 2023
@mark2185
Copy link
Contributor

Duplicate of #488.

@ownicn
Copy link
Author

ownicn commented Oct 24, 2023

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"

@alexravenna
Copy link

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

@riley-van-hengstum
Copy link

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

@mark2185
Copy link
Contributor

What if you set it to an empty string?

@riley-van-hengstum
Copy link

riley-van-hengstum commented Oct 29, 2023

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

@dwvwdv
Copy link

dwvwdv commented Nov 11, 2023

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

@guss77
Copy link

guss77 commented Feb 12, 2024

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.

@c3cris
Copy link

c3cris commented Feb 27, 2024

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

@RollsChris
Copy link

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

@RollsChris
Copy link

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

@hiro345g
Copy link

hiro345g commented Mar 21, 2024

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)

@fmanso
Copy link

fmanso commented May 30, 2024

Any update on this ? How would be the workaround for Windows with Docker Desktop ?

@peauc
Copy link
Contributor

peauc commented Jun 8, 2024

@fmanso would you be able to provide a ~/.docker/config.json that is problematic? I can look onto this issue

@peauc
Copy link
Contributor

peauc commented Jun 18, 2024

I have managed to reproduce this issue on Linux, fix it & draft a PR

@gsenseless
Copy link

gsenseless commented Aug 11, 2024

Stil getting this error.
My problematic config.json:

{
        "auths": {},
        "credStore": "desktop",
        "currentContext": "default",
        "plugins": {
                "-x-cli-hints": {
                        "enabled": "true"
                }
        }
}

@peauc
Copy link
Contributor

peauc commented Aug 11, 2024

@gsenseless I believe this code has not yet landed on master :).

@matheustavarestrindade
Copy link

If you are having this problem on windows, i just solved with the cmd: docker context use default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests