如何使用Origin的集成注册表构建?

时间:2016-10-17 21:50:14

标签: kubernetes openshift-origin

我正在尝试学习Openshift / Origin / Kubernetes,因此我遇到了许多新手打嗝之一。

如果我使用此yml文件构建图像:

apiVersion: v1
items:
- apiVersion: v1
  kind: ImageStream
  metadata:
    annotations:
      openshift.io/generated-by: OpenShiftNewApp
    creationTimestamp: null
    labels:
      app: myapp-dev
    name: myapp-dev
  spec: {}
  status:
    dockerImageRepository: ""
- apiVersion: v1
  kind: BuildConfig
  metadata:
    annotations:
      openshift.io/generated-by: OpenShiftNewApp
    creationTimestamp: null
    labels:
      app: myapp-dev
    name: myapp-dev
  spec:
    output:
      to:
        kind: ImageStreamTag
        name: myapp-dev:latest
    postCommit: {}
    resources: {}
    source:
      git:
        ref: master
        uri: git@git.host:myproject/myapp.git
      secrets: []
      sourceSecret:
        name: "deploykey"
      type: Git
    strategy:
      dockerStrategy:
        dockerfilePath: Dockerfile
      type: Docker
    triggers:
    - type: ConfigChange
    - imageChange: {}
      type: ImageChange
  status:
    lastVersion: 0
kind: List
metadata: {}

我还有其他Dockerfiles,我想使用上一版本的输出图像,如何在Dockerfile中引用集成注册表?现在,我只是在观看构建日志并使用Dockerfile的FROM指令中的日志中列出的IP和端口。

所以构建日志显示:

Successfully built 40ff8724d4dd
I1017 17:32:24.330274 1 docker.go:93] Pushing image 123.123.123.123:5000/myproject/myapp-dev:latest ...

所以我在Dockerfile中使用了它:

FROM 123.123.123.123:5000/myproject/myapp-dev:latest  

您可以提供的任何指导都很棒。

我想做点什么:

FROM integrated.registry/myproject/myapp-dev:latest

感谢您的时间!

1 个答案:

答案 0 :(得分:0)

构建配置对象允许您覆盖FROM。如果你看一下oc new-build或new-app创建的构建配置,你会看到字段spec.strategy.dockerStrategy.from,它可以指向你想要的任何泊坞窗图像。要指向图像流使用" kind" as" ImageStreamTag",设置"名称"到" myapp-dev:最新"

如果您在OpenShift之外构建并为注册表提供公共DNS名称,则只需将FROM设置为registry / project / name:tag