Docker ~ 粘贴到交互式 PowerShell 终端中

Kir*_*ari 5 powershell docker

我有以下问题:

\n\n

在 Windows 计算机上,我使用 PowerShell CLI 来运行运行 microsoft/mssql-server-windows-express 的容器。我可以使用命令“docker exec -it my_container powershell”在该容器中打开交互式 PowerShell 会话,但在该交互式终端中,我无法从外部粘贴任何文本。

\n\n

比如说,我想粘贴以下行:

\n\n
echo (Get-ItemProperty -Path \xe2\x80\x98Registry::HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\Environment\xe2\x80\x99 -Name PATH).path\n
Run Code Online (Sandbox Code Playgroud)\n\n

使用 [Ctrl]+[V] 仅返回以下内容(与非交互式 docker PowerShell 会话 PowerShell CLI 不同,在其中粘贴文本没有任何问题):

\n\n
^V\n
Run Code Online (Sandbox Code Playgroud)\n\n

我还尝试过右键单击控制台背景,或右键单击控制台窗口标题,然后选择[编辑] > [粘贴]。但是,这只会提供以下损坏和截断的结果:

\n\n
echo (Get-ItemProperty -Path ?^?^?Registry::HKEY_LOC\n
Run Code Online (Sandbox Code Playgroud)\n\n

我已经尝试将以下行添加到我的 Dockerfile 中,如本页所述所述:

\n\n
WORKDIR "Program Files"\nRUN rd /S /Q WindowsPowerShell\\Modules\\PSReadLine\nWORKDIR /\n
Run Code Online (Sandbox Code Playgroud)\n\n

但是,这只会在尝试构建映像时导致以下错误:

\n\n
Step 11/12 : RUN rd /S /Q WindowsPowerShell\\Modules\\PSReadLine\n ---> Running in 95497bbaf4cf\nRemove-Item : A positional parameter cannot be found that accepts argument\n\'/Q\'.\nAt line:1 char:76\n+ ... e = \'SilentlyContinue\'; rd /S /Q WindowsPowerShell\\Modules\\PSReadLine\n+                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n    + CategoryInfo          : InvalidArgument: (:) [Remove-Item], ParentContai\n   nsErrorRecordException\n    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell\n   .Commands.RemoveItemCommand\n
Run Code Online (Sandbox Code Playgroud)\n\n

所以,我的问题是:是否可以粘贴到通过 PowerShell 访问的容器中运行的交互式 PowerShell 会话中?或者这是某种“开始”——不同系统的分层导致无法正确粘贴的问题?

\n