cli icon indicating copy to clipboard operation
cli copied to clipboard

fix 1476 let ssh use stdin to type password when docker run with -it

Open lifubang opened this issue 7 years ago • 8 comments

Signed-off-by: Lifubang [email protected]

- What I did As the issue #1476, when use ssh with password, docker run -it will fail.

- How I did it Because after attachContainer, ssh can't use stdin to type password. So, in func attachContainer, use a call back func beforeHijack to run ContainerStart before hijackedIOStreamer.

- How to verify it After fix:

docker -H ssh://localhost  run --name=testssh -it --entrypoint=/bin/bash docker.acmcoder.com/public/ubuntu:ssh
root@localhost's password: 
root@localhost's password: 
root@localhost's password: 
root@25eaf3b846dc:/# ls -lh
total 64K
drwxr-xr-x   2 root root 4.0K Oct  1  2015 bin
drwxr-xr-x   2 root root 4.0K Apr 10  2014 boot

- Description for the changelog modify attachContainer add a param "beforeHijack func() error"

- A picture of a cute animal (not mandatory but encouraged) h _zaman0 0 al 3 _luj

lifubang avatar Oct 23 '18 03:10 lifubang

Codecov Report

Merging #1477 into master will decrease coverage by 0.95%. The diff coverage is 25%.

@@            Coverage Diff             @@
##           master    #1477      +/-   ##
==========================================
- Coverage   55.14%   54.19%   -0.96%     
==========================================
  Files         289      289              
  Lines       19371    19386      +15     
==========================================
- Hits        10683    10506     -177     
- Misses       7997     8204     +207     
+ Partials      691      676      -15

codecov-io avatar Oct 23 '18 03:10 codecov-io

ping @AkihiroSuda PTAL

lifubang avatar Oct 23 '18 04:10 lifubang

Thx, can we have e2e?

AkihiroSuda avatar Oct 23 '18 04:10 AkihiroSuda

Thx, can we have e2e? @AkihiroSuda It's very hard to add e2e case, because:

  1. We need expect to auto input user's password;
  2. But expect have no stderr;
  3. There is at least one "root@localhost's password:" in stdout, it's very hard to remove it.

So, I think it's very hard to add e2e case. You can see my commit: https://github.com/lifubang/cli/commit/b121f2484944605cefdefd068215349518437e49 I think we can add e2e cases in a new PR if we need.

lifubang avatar Oct 24 '18 10:10 lifubang

Yes, E2E can be added separately, but I think password auth should not be considered to be supported officially for now then https://github.com/docker/cli/pull/1482

AkihiroSuda avatar Oct 25 '18 07:10 AkihiroSuda

What's current status?

AkihiroSuda avatar Mar 02 '19 12:03 AkihiroSuda

This patch can input password correctly. But I can't find a way to add a test case, I have no idea now. If someone have a time, please take a look #1487 . Thanks.

lifubang avatar Mar 02 '19 13:03 lifubang

Will this be fixed soon? I cant use my development docker cli with my home server. I really need this!

makinori avatar Sep 25 '19 21:09 makinori