Skip to content

Fix ssh context not working#577

Open
peauc wants to merge 13 commits into
jesseduffield:masterfrom
peauc:feature/issue-559
Open

Fix ssh context not working#577
peauc wants to merge 13 commits into
jesseduffield:masterfrom
peauc:feature/issue-559

Conversation

@peauc

@peauc peauc commented Sep 2, 2024

Copy link
Copy Markdown
Contributor

Fix issue as described in #559

@peauc

peauc commented Sep 2, 2024

Copy link
Copy Markdown
Contributor Author

It seems that I was missing the code of the PR #511 that was merged early June.
I still have the issue using my now fresh copy of master.

The code of this branch is a bit cleaner and now works for me

@peauc

peauc commented Sep 3, 2024

Copy link
Copy Markdown
Contributor Author

I'll get to the tests in a few days.

@jesseduffield jesseduffield left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments :)

Comment thread pkg/commands/docker.go Outdated
Comment thread pkg/commands/docker.go Outdated
client.FromEnv,
client.WithVersion(APIVersion),
}
// For an ssh connection the DOCKER_HOST env variable has been overridden.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain the rationale behind these changes? I'm not clear on the reasoning

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wired it correctly for the SSH connection to work.
I'll rework it so its clearer and doesn't rely on a modified docker host env variable.

@peauc peauc May 4, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @jesseduffield took over 6 months to get some free time but now that I'm in vacation... :D

The rationale is that ATM ssh tunneling with docker context over lazydocker is broken. There are a few issues regarding this see this link
In my opinion those issues are due to an edge case in the current implementation of the ssh tunneling & docker host parsing.
I've rewritten a few parts to both make it simpler and more robust, tell me what you think :)

@bill-mccormick-dg

bill-mccormick-dg commented Sep 19, 2025

Copy link
Copy Markdown

Anyway this get's merged soon @jesseduffield? I'd love to have it.

@wpcarro

wpcarro commented Nov 22, 2025

Copy link
Copy Markdown

What's the latest here?

@peauc

peauc commented Nov 22, 2025

Copy link
Copy Markdown
Contributor Author

@wpcarro waiting for merge on this repo. Works on my fork.

@bill-mccormick-dg

bill-mccormick-dg commented Nov 22, 2025 via email

Copy link
Copy Markdown

@peauc

peauc commented Dec 26, 2025

Copy link
Copy Markdown
Contributor Author

If anyone is interested in this thread. I've released lazydocker-ng with a bunch of fixes that where never merged.

@francoiscabrol

Copy link
Copy Markdown

I am facing the same issue. Thank you, @peauc, for providing a solution. Would it be possible to review it again, @jesseduffield? I have checked with the fork, and the issue is gone. It would be awesome to have it merge in the main project!

@francoiscabrol

Copy link
Copy Markdown

I have an update: maybe my issue was a bit different. My issue was about getting ssh tunneled socket never became available: context deadline exceeded (like #591) running DOCKER_HOST=ssh://user@domain:2222 ~/go/bin/lazydocker
With the fork lazydocker-ng, this command works without error.

But I realize that I can actually connect through ssh with the main project if I omit the port in the command DOCKER_HOST=ssh://user@domain ~/go/bin/lazydocker

@peauc

peauc commented Mar 26, 2026

Copy link
Copy Markdown
Contributor Author

@francoiscabrol, yeah there is an issue with the way the docker host is consumed.
Your workaround is a good one if you have the default ssh port.

@vlanx

vlanx commented Apr 4, 2026

Copy link
Copy Markdown

I have an update: maybe my issue was a bit different. My issue was about getting ssh tunneled socket never became available: context deadline exceeded (like #591) running DOCKER_HOST=ssh://user@domain:2222 ~/go/bin/lazydocker With the fork lazydocker-ng, this command works without error.

But I realize that I can actually connect through ssh with the main project if I omit the port in the command DOCKER_HOST=ssh://user@domain ~/go/bin/lazydocker

This did not work for me either, port or no port.
What did though, was creating an entry in my ssh config file like so:

Host remote-context
  Hostname 10.16.10.1
  User ubuntu

Then, the DOCKER_HOST url can be DOCKER_HOST=ssh://remote-context lazydocker which makes it work for me.
I've wrapped into a zsh helper function and autocompletes with ssh aliases too.

lzd() {
  local host_alias="$1"

  if [ -z "$host_alias" ]; then
    echo "usage: lzd <ssh-host-alias>"
    return 1
  fi

  DOCKER_HOST="ssh://$host_alias" lazydocker
}

compdef lzd=ssh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants