如何从Cloud Foundry上的存储库部署Docker映像?

时间:2018-10-12 10:38:15

标签: docker rstudio cloudfoundry

我推送了docker映像

cf push --docker-image rocker/rstudio --docker-username rstudio-test

以及登台过程何时开始

我发现401错误

Failed getting docker image by tag: Get https://registry-1.docker.io/v2/rocker/rstudio/manifests/latest: token auth attempt for registry: https://auth.docker.io/token?account=myuser&scope=repository%3Arocker%2Frstudio%3Apull&service=registry.docker.io request failed with status: 401 Unauthorized  Going to retry attempt: 1
Failed getting docker image by tag: Get https://registry-1.docker.io/v2/rocker/rstudio/manifests/latest: token auth attempt for registry: https://auth.docker.io/token?account=myuser&scope=repository%3Arocker%2Frstudio%3Apull&service=registry.docker.io request failed with status: 401 Unauthorized  Going to retry attempt: 2
Failed getting docker image by tag: Get https://registry-1.docker.io/v2/rocker/rstudio/manifests/latest: token auth attempt for registry: https://auth.docker.io/token?account=myuser&scope=repository%3Arocker%2Frstudio%3Apull&service=registry.docker.io request failed with status: 401 Unauthorized  Going to retry attempt: 3
Failed getting docker image by tag: Get https://registry-1.docker.io/v2/rocker/rstudio/manifests/latest: token auth attempt for registry: https://auth.docker.io/token?account=myuser&scope=repository%3Arocker%2Frstudio%3Apull&service=registry.docker.io request failed with status: 401 Unauthorized
Staging process failed: Exit trace for group:
builder exited with error: failed to fetch metadata from [rocker/rstudio] with tag [latest] and insecure registries [] due to Get https://registry-1.docker.io/v2/rocker/rstudio/manifests/latest: token auth attempt for registry: https://auth.docker.io/token?account=myuser&scope=repository%3Arocker%2Frstudio%3Apull&service=registry.docker.io request failed with status: 401 Unauthorized
Exit status 2

我做了清单并放入env选项

env: 
 CF_DOCKER_PASSWORD:test

我尝试搜索信息 但我仍然不知道答案

1 个答案:

答案 0 :(得分:1)

这个...

env: 
 CF_DOCKER_PASSWORD:test

不是您想要的。这告诉cf cli设置应用程序可访问的环境变量。只有在您的应用程序启动后才能访问。不过,我们需要先下载容器,然后才能运行它,因此在此处设置容器为时已晚。

您想在计算机上本地设置环境变量,以便在cf cli运行时知道要使用的密码。

因此,您想要...

Mac / Linux:

export CF_DOCKER_PASSWORD=test

Windows:

set CF_DOCKER_PASSWORD=test

然后您可以运行cf push --docker-image rocker/rstudio --docker-username rstudio-test。 cf cli将从您的本地环境变量中读取密码并将其传递给密码,以便平台可以下载您的docker映像。

作为FYI,Mac和Linux用户也可以使用简写CF_DOCKER_PASSWORD=test cf push ...。我认为这在Windows上不起作用。

在此处查看更多详细信息:

https://docs.cloudfoundry.org/devguide/deploy-apps/push-docker.html#private-repo