gpt4 book ai didi

powershell - 无法从Docker Hub提取图像

转载 作者:行者123 更新时间:2023-12-03 00:12:44 26 4
gpt4 key购买 nike

我正在尝试使事情自动化。我有一个PowerShell脚本,它将启动Amazon实例并安装docker.i能够登录到Docker登录名但无法提取图像。当我从Windows PowerShell命令行执行此操作时,它可以正常工作,但是当我在脚本中执行此操作时,它将不起作用。请在下面找到脚本。

"$ Docker Login"
$DOCKER_USER="xxxx"
$DOCKER_PASS="xxxx"
docker login --username=$DOCKER_USER --password=$DOCKER_PASS

docker pull将无法正常工作,而是像这样挂起:
PS C:\Users\Administrator\Desktop> docker pull 474614/my_repo:javaprogram
javaprogram: Pulling from 474614/my_repo
3889bb8d808b: Pulling fs layer
423d66441981: Pulling fs layer
31d767f25d17: Pulling fs layer
b97cf9d73d51: Pulling fs layer
03004a043191: Pulling fs layer
19506dd59345: Pulling fs layer
5126364976fd: Pulling fs layer
62d7464c27c0: Pulling fs layer
e332822eeca9: Pulling fs layer
7b86ee31be04: Pulling fs layer
d0e690ab14f8: Pulling fs layer
1fc46d77d062: Pulling fs layer
b7a18b2502fb: Pulling fs layer
ae19e0bac7c9: Pulling fs layer
b97cf9d73d51: Waiting
03004a043191: Waiting
19506dd59345: Waiting
5126364976fd: Waiting
62d7464c27c0: Waiting
e332822eeca9: Waiting
7b86ee31be04: Waiting
d0e690ab14f8: Waiting
1fc46d77d062: Waiting
b7a18b2502fb: Waiting
ae19e0bac7c9: Waiting
31d767f25d17: Verifying Checksum
31d767f25d17: Download complete
b97cf9d73d51: Verifying Checksum
b97cf9d73d51: Download complete
03004a043191: Verifying Checksum
03004a043191: Download complete
19506dd59345: Verifying Checksum
19506dd59345: Download complete
5126364976fd: Verifying Checksum
5126364976fd: Download complete
62d7464c27c0: Verifying Checksum
62d7464c27c0: Download complete
e332822eeca9: Verifying Checksum
e332822eeca9: Download complete
7b86ee31be04: Verifying Checksum
7b86ee31be04: Download complete
d0e690ab14f8: Verifying Checksum
d0e690ab14f8: Download complete
1fc46d77d062: Verifying Checksum
1fc46d77d062: Download complete
b7a18b2502fb: Verifying Checksum
b7a18b2502fb: Download complete
ae19e0bac7c9: Verifying Checksum
ae19e0bac7c9: Download complete
423d66441981: Verifying Checksum
423d66441981: Download complete

PS C:\Users\Administrator\Desktop>

请帮助我使用PowerShell脚本,该脚本将从Windows计算机上的docker hub中提取图像。
关于此的任何建议将有所帮助。提前致谢

最佳答案

我使用此脚本来标记我的图像。

$account    = "myusername"
$reponame = "myreponame"
$version = "2.0.0"

$latest = $account + "/" + $reponame + ":latest"
$newest = $account + "/" + $reponame + ":" + $version

docker pull $latest
docker tag $latest $newest
docker push $newest
docker push $latest

尝试在Windows CMD中运行命令。我经验丰富的Powershell在使用Docker for Windows时显示较少的信息。

关于powershell - 无法从Docker Hub提取图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44742850/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com