linux - 使用ssh在远程Windows机器上进行Docker登录

标签 linux shell powershell docker ubuntu

我已经在 Windows 机器上安装了 ssh 代理,并且我在那里有 powershell 脚本来构建一个容器。

MyBuild.ps1

$awslogin = aws ecr get-login --no-include-email --region eu-west-2

Invoke-Expression $awslogin

cd "C:\Buildfolder"

docker build -t newimage .

docker tag newimage 123456789.dkr.ecr.us-west-1.amazonaws.com:aug2018

docker push 123456789.dkr.ecr.us-west-1.amazonaws.com:aug2018

echo "Process Completed"

我正在使用以下命令从 linux 机器调用远程 powershell 脚本。

sshpass -p 'mypasswd' ssh Administrator@X.X.X.X powershell C:/Buildfolder/MyBuild.ps1

在运行脚本时,docker ecr 登录出现以下错误。

Error saving credentials: error storing credentials - err: exit status 1, out: `A specified logon session does not exist. It may already have been terminated.`

虽然我从 Windows 手动运行 powershell 脚本,但它运行良好。此外,通过 ssh 的所有其他命令都可以正常工作,期待 docker ecr 登录。

我的目标是在远程 Windows 机器上构建 docker 镜像。我该怎么做?

最佳答案

非常类似的场景,但与 powershell 不同 - 从 .docker/config.json 中删除“credsStore”行有帮助。

** 编辑 **

无论出于何种原因,重新启动后它都停止工作了。之后重新删除 credsStore 也无济于事。

关于linux - 使用ssh在远程Windows机器上进行Docker登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51648174/

相关文章:

linux - 在 Scala 脚本中自行修改类路径?

powershell - 如何创建 Azure AD 应用程序 key ?

powershell - 使用 Start-Process 使用参数运行脚本 block 命令

powershell - 将带前缀的文件放在带编号的文件夹中

linux - 段错误 sysfs gpio linux odroid

linux - 如何使用 AWK 打印最高编号的行?

linux - 如何在 Linux shell 中制作 Hashmap?

linux - 读取作为终端命令的变量

java.io.IOException : error=11 异常

bash - bash 中的源脚本,脚本中存在 $ 字符