我正在将docker应用程序部署到运行在swisscom云(website)上的云代工厂。这是我的部署脚本的片段。
...
export CF_DOCKER_PASSWORD=$CI_REGISTRY_PASSWORD
cf push $APP_NAME -f "$MANIFEST_FILE" --vars-file $VARS_FILE
到目前为止,应用程序创建并启动没有任何问题。
Waiting for app to start...
name: app_name
requested state: started
routes: app_name.scapp.io
last uploaded: Mon 25 Feb 11:55:01 UTC 2019
stack:
docker image: registry.gitlab.com/org_name/app_name:master
type: web
instances: 1/1
memory usage: 192M
start command: npm start
state since cpu memory disk details
#0 running 2019-02-25T11:55:45Z 13.3% 95.7M of 192M 974.7M of 3G
但是如果应用程序崩溃并且CF尝试重新启动它,我会收到以下错误。
2019-02-25 12:34:01 [CELL/0] OUT Cell 9f61c89b-5496-4f3a-a332-74084c0db365 creating container for instance 7f8762ce-d004-425e-729f-bfbd
2019-02-25 12:34:04 [CELL/0] ERR Cell 9f61c89b-5496-4f3a-a332-74084c0db365 failed to create container for instance 7f8762ce-d004-425e-729f-bfbd: running image plugin create: fetching image reference: creating image: unable to retrieve auth token: invalid username/password
2019-02-25 12:34:04 [CELL/0] ERR : exit status 1
manifest.yml
---
applications:
- name: app_name
memory: 192M
instances: 1
disk_quota: 3G
routes:
app_name.scapp.io
docker:
image: registry.gitlab.com/org_name/app_name:master
username: registry_user_here
如何让CF成功重启应用程序?
我正在使用gitlab ci来部署到云代工厂。
docker镜像存储在gitlab的docker注册表中,我在构建期间使用gitlab提供的密码进行身份验证($CI_REGISTRY_PASSWORD
)。
事实证明,这只是一个临时密码,当云代工厂尝试重新启动应用程序时,它不再有效。我正在使用个人访问令牌而不是提供的登录,现在它完美无缺。