Powershell ISE 无法连接到 Docker 容器/Windows 容器

Powershell ISE 无法连接到 Docker 容器/Windows 容器

我可以连接附加到 Windows 2016 Server 上的 docker 容器/windows 容器使用 Powershell 就很好了。

但当我尝试同样的事情时Powershell ISE,我得到了错误以下。

PS C:\> docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
934be056524b        iis                 "cmd"               11 minutes ago      Up 22 seconds                           iisdemo2
f65fc4ec8cd3        iis                 "cmd"               2 days ago          Up 24 hours                             iisdemo

PS C:\> docker attach iisdemo2
docker : panic: runtime error: invalid memory address or nil pointer dereference
At line:1 char:1
+ docker attach iisdemo2
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (panic: runtime ...ter dereference:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

[signal 0xc0000005 code=0x0 addr=0x28 pc=0x4a9433
]
goroutine 25 [running]:
github.com/Sirupsen/logrus.(*Logger).Debugf(0x0, 0x135fd40, 
0x4e
, 0xc08268b998, 0x3, 0x3)

/go/src/github.com/docker/docker/vendor/src/github.com/Sirupsen/logrus/logger.go:68 +0x23
github.com/docker/docker/pkg/term/windows.readInputEvents(0x354, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0)
    /go/src/github.com/docker/docker/pkg/term/windows/ansi_reader.go:115 +0x262
github.com/docker/docker/pkg/term/windows.(*ansiReader).Read(0xc08200c1e0, 0xc082690000, 0x8000, 0x8000, 0x8000, 0x0, 0x0)
    /go/src/github.com/docker/docker/pkg/term/windows/ansi_reader.go:74 +0x47b
io.copyBuffer(0x1c4c6a0, 0xc082670190, 0x1c4c628, 0xc08200c1e0, 0xc082690000, 0x8000, 0x8000, 0x0, 0x0, 0x0)
    /usr/local/go/src/io/io.go:381 +0x24e
io.Copy(0x1c4c6a0, 0xc082670190, 0x1c4c628, 0xc08200c1e0, 0xc082670190, 0x0, 0x0)
    /usr/local/go/src/io/io.go:351 +0x6b
net.genericReadFrom(0x1c4c4d0, 0xc0821ec128, 0x1c4c628, 0xc08200c1e0, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/net.go:559 +0xb8
net.(*TCPConn).ReadFrom(0xc0821ec128, 0x1c4c628, 0xc08200c1e0, 0xc08268be28, 0x0, 0x0)
    /usr/local/go/src/net/tcpsock_posix.go:63 +0x2f8
io.copyBuffer(0x1c4c4d0, 0xc0821ec128, 0x1c4c628, 0xc08200c1e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/io/io.go:375 +0x187
io.Copy(0x1c4c4d0, 0xc0821ec128, 0x1c4c628, 0xc08200c1e0, 0xc08200c1e0, 0x0, 0x0)
    /usr/local/go/src/io/io.go:351 +0x6b
github.com/docker/docker/api/client.(*DockerCli).hijackWithContentType.func3(0x1c9a1a8, 0xc08200c1e0, 0x1c9a358, 0xc0821ec128, 0xc0826761e0)
    /go/src/github.com/docker/docker/api/client/hijack.go:228 +0xe2
created by github.com/docker/docker/api/client.(*DockerCli).hijackWithContentType
    /go/src/github.com/docker/docker/api/client/hijack.go:240 +0xd43
goroutine 1 [select]:
github.com/docker/docker/api/client.(*DockerCli).hijackWithContentType(0xc08200e0c0, 0x11a31a0, 0x4, 0xc08219f740, 0x3e, 0x11cf4f0, 0xa, 0x1, 0x1c9a1a8, 
0xc08200c1e0, ...)
    /go/src/github.com/docker/docker/api/client/hijack.go:242 +0x10f5
github.com/docker/docker/api/client.(*DockerCli).hijack(0xc08200e0c0, 0x11a31a0, 0x4, 0xc08219f740, 0x3e, 0x11b0a01, 0x1c9a1a8, 0xc08200c1e0, 0x1c042c0, 
0xc082026010, ...)
    /go/src/github.com/docker/docker/api/client/hijack.go:130 +0x116
github.com/docker/docker/api/client.(*DockerCli).CmdAttach(0xc08200e0c0, 0xc082003eb0, 0x1, 0x1, 0x0, 0x0)
    /go/src/github.com/docker/docker/api/client/attach.go:75 +0x114f
reflect.callMethod(0xc082531770, 0xc082667c78
)
    /usr/local/go/src/reflect/value.go:628 +0x203
reflect.methodValueCall(
0xc082003eb0, 0x1, 0x1, 0x1, 0xc082531770, 0x0, 0x0, 0xc082531770, 0x0, 0x46e6db, ...)
    /usr/local/go/src/reflect/asm_amd64.s:29 +0x3d
github.com/docker/docker/cli.(*Cli).Run
(0xc082531590, 0xc082003ea0, 0x2
, 0x2, 0x0
, 0x0)

/go/src/github.com/docker/docker/cli/cli.go:89 +0x38a
main.main()
    /go/src/github.com/docker/docker/docker/docker.go:63 +0x31e
goroutine 
17
 [
syscall, locked to thread]:
runtime.goexit
(
)
    /usr/local/go/src/runtime/asm_amd64.s:1696 +0x1
goroutine 
5
 [syscall]:
os/signal.loop()
    /usr/local/go/src/os/signal/signal_unix.go
:22 +0x1f
created by os/signal.init.1
    /usr/local/go/src/os/signal/signal_unix.go:28 +0x3e
goroutine 23 [chan receive]:
github.com/docker/docker/pkg/term.restoreAtInterrupt.func1(
0xc082676120, 0x354
, 0xc082670130)
    /go/src/github.com/docker/docker/pkg/term/term_windows.go:259 +0x4a
created by github.com/docker/docker/pkg/term.restoreAtInterrupt

/go/src/github.com/docker/docker/pkg/term/term_windows.go:
262 +0xee
goroutine 21 [IO wait]:
net.runtime_pollWait(0x1c9b328, 
0x72, 0xc08253a5d0
)
    /usr/local/go/src/runtime/netpoll.go:157 +0x67
net.(*pollDesc).Wait(0xc0824f48f0
, 
0x72
, 0x0, 0x0
)
    /usr/local/go/src/net/fd_poll_runtime.go
:73
 +0x41
net.(*ioSrv).ExecIO(0xc0821ec110, 0xc0824f47e0, 0x11a4408, 0x7, 0x13eb508, 0x190930, 0x0, 0x0)
    /usr/local/go/src/net/fd_windows.go:182 +0x177
net.(*netFD).Read(0xc0824f4780, 0xc082678000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/fd_windows.go:463 +0x17e
net.(*conn).Read(0xc082026000, 0xc082678000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/net.go:172 +0xeb
net/http.noteEOFReader.Read(0x1c4c480, 0xc082026000, 0xc08200a268, 0xc082678000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/http/transport.go:1370 +0x6e
net/http.(*noteEOFReader).Read(0xc082672080, 0xc082678000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    <autogenerated>:126 +0xd7
bufio.(*Reader).fill(0xc082676000)
    /usr/local/go/src/bufio/bufio.go:97 +0x1f0
bufio.(*Reader).Peek(0xc082676000, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/bufio/bufio.go:132 +0xd3
net/http.(*persistConn).readLoop(0xc08200a210)
    /usr/local/go/src/net/http/transport.go:876 +0xfe
created by net/http.(*Transport).dialConn
    /usr/local/go/src/net/http/transport.go:685 +0xc7f
goroutine 22 [select]:
net/http.(*persistConn).writeLoop(0xc08200a210)
    /usr/local/go/src/net/http/transport.go:1009 +0x413
created by net/http.(*Transport).dialConn
    /usr/local/go/src/net/http/transport.go:686 +0xca4
goroutine 24 [runnable]:
github.com/docker/docker/api/client.(*DockerCli).hijackWithContentType.func2(0x1c9a1a8, 0xc08200c1e0, 0x1, 0xc08200e0c0, 0xc082670130, 0x1c042c0, 
0xc082026010, 0xc082684090, 0xc082013560, 0x1c042c0, ...)
    /go/src/github.com/docker/docker/api/client/hijack.go:204
created by github.com/docker/docker/api/client.(*DockerCli).hijackWithContentType
    /go/src/github.com/docker/docker/api/client/hijack.go:222 +0x1192

在此处输入图片描述

答案1

好的,看来Docker 命令(docker 运行,docker 附加)在 Powershell ISE 中不起作用,(但它们在 Powershell 中工作)。

当我使用Powershell 命令(Get-Container、New-Container、Start-Container等),它运行良好。

根据一位 Docker 团队成员的要求,我在 Docker 的 github 上创建了一张票,以便进一步讨论:https://github.com/docker/docker/issues/21368

相关内容