openshift online:StartContainer出错 - ErrImagePull:“未授权:需要身份验证”

时间:2017-07-30 21:20:53

标签: docker openshift

我是openshift的新手,我有一个showstopper:

在我的计算机上,我创建了一个名为import React, { Component } from 'react'; import { connect } from 'react-redux'; import { fetchPinnedStocks, deletePinnedStock, fetchStockData } from '../redux/modules/Stock/actions'; import '../styles/spin.css'; import Panel from 'react-uikit-panel'; class StockCard extends Component { render() { const user_id = localStorage.getItem('currentUser_id') const stock = this.props.stock //should be the stockObj keyed by name if (!stock) { return null } else { return ( <Panel col='1-2' box title={stock.name} margin='bottom' context='primary'> <div> Open: {stock.openingPrice} </div> <div> Close: {stock.closingPrice} </div> <div> Low: {stock.low} </div> <div> High: {stock.high} </div> <div> Trading Volume: {stock.volume} </div> <button type="submit" onClick={deletePinnedStock(user_id, stock.name, stock.id)}>Remove</button> </Panel>) } } } function mapStateToProps(state) { return { currentUser: state.auth.currentUser, stocksData: state.stock.stocksData } } export default connect(mapStateToProps, { fetchPinnedStocks, deletePinnedStock, fetchStockData })(StockCard); 的Dockerimage,并成功测试了它:

restservice

然后我在Openshift-Online中使用图片创建了一个应用程序:

docker run -d -p 8080:8080 restservice

我可以看到deploy-pod正在启动,并且在创建正在运行的pod后失败。

oc new-app restservice

我收到以下错误:

oc describe pod restservice-2-50n0h

我不知道身份验证是什么。

1 个答案:

答案 0 :(得分:2)

缺少的步骤是将图像推送到在线openhift。

所以这些是步骤:

  • 在本地计算机上构建图像

    docker build -t restservice .

  • 使用registry / username / image-name标记

    docker tag restservice registry.starter-us-west2.openshift.com/myusername/myrestservice

  • 获取登录Openshift注册表的秘密

    oc whoami -t sr3grwkegr3kjrk42k2jrg34kb5k43g5k4jg53(sr3 ...是输出)

  • 登录Openshift Registry

    docker login -u name@mail.com -p sr3grwkegr3kjrk42k2jrg34kb5k43g5k4jg53 https://registry.starter-us-west-2.openshift.com

  • 将图像推送到注册表

    docker push registry.starter-us-west-2.openshift.com/myusername/myrestservice

  • 使用图片

    创建新应用

    oc new-app myrestservice

多数人......