无法从docker hub中提取图像

时间:2017-06-25 03:10:03

标签: powershell powershell-remoting docker-windows

我试图让事情自动化。我有一个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中提取图像。 对此有任何建议会有所帮助。提前致谢

1 个答案:

答案 0 :(得分:0)

我使用这个脚本来标记我的图像......它有效。

$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中运行命令。在使用Docker for Windows时,我体验过Powershell显示的信息较少。