Openshift新应用程序不适用于dockerfile

Openshift新应用程序不适用于dockerfile,openshift,openshift-origin,Openshift,Openshift Origin,我正在尝试使用CLI在Openshift中部署新的应用程序。当我使用GUI并单击“从docker文件构建”时,一切正常。但当我使用CLI时,它不会 以下是我的回购协议中的文件: Dockerfile FROM golang:1.11-alpine RUN mkdir /app COPY main.go /app WORKDIR /app RUN go build -o main . EXPOSE 8080 8888 USER 1001 ENTRYPOINT ["/app/main"] 梅因,加

我正在尝试使用CLI在Openshift中部署新的应用程序。当我使用GUI并单击“从docker文件构建”时,一切正常。但当我使用CLI时,它不会

以下是我的回购协议中的文件:

Dockerfile

FROM golang:1.11-alpine
RUN mkdir /app
COPY main.go /app
WORKDIR /app
RUN go build -o main .
EXPOSE 8080 8888
USER 1001
ENTRYPOINT ["/app/main"]
梅因,加油

package main

import (
    "fmt"
    "net/http"
)

func helloHandler(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintln(w, "<h1>Hello OpenShift! Updated build</h1>")
}

func listenAndServe(port string) {
    fmt.Printf("serving on %s\n", port)
    err := http.ListenAndServe(":"+port, nil)
    if err != nil {
        panic("ListenAndServe: " + err.Error())
    }
}

func main() {
    http.HandleFunc("/", helloHandler)
    go listenAndServe("8080")
    select {}
}
这给了我以下的错误

error: unable to load template file "https://git.abcd.corp.mycompany.com/12345/openshift-trail.git#development": error parsing https://git.abcd.corp.mycompany.com/12345/openshift-trail.git#development: error converting YAML to JSON: yaml: line 3: mapping values are not allowed in this context
error: git ls-remote failed with: fatal: unable to access 'https://git.abcd.corp.mycompany.com/12345/openshift-trail.git/': Problem with the SSL CA cert (path? access rights?);  local file access failed with: stat https://git.abcd.corp.mycompany.com/12345/openshift-trail.git#development: no such file or directory
error: unable to locate any images in image streams, templates loaded in accessible projects, template files, local docker images with name "https://git.abcd.corp.mycompany.com/12345/openshift-trail.git#development"

Argument 'https://git.abcd.corp.mycompany.com/12345/openshift-trail.git#development' was classified as an image, image~source, or loaded template reference.

The 'oc new-app' command will match arguments to the following types:

  1. Images tagged into image streams in the current project or the 'openshift' project
     - if you don't specify a tag, we'll add ':latest'
  2. Images in the Docker Hub, on remote registries, or on the local Docker engine
  3. Templates in the current project or the 'openshift' project
  4. Git repository URLs or local paths that point to Git repositories

--allow-missing-images can be used to point to an image that does not exist yet.

根据,它说如果回购协议中有Dockerfile,它应该自动检测它。但在这里我得到了一个奇怪的错误,我无法理解。非常感谢您的帮助。

您只需在自己的计算机上将其构建为常规Docker文件,并将其上载到Docker注册表,然后从远程注册表将其部署到openshift,甚至可以将其推送到openshift上的内置注册表

我想你要找的命令可能是


    oc new-build

本文可能有助于:


谢谢@OpenBSDNinja的回答。我正在寻找一种方法,通过使用
oc新应用程序
,让事情变得更简单。此外,Opeshift doco表示,它将在回购协议中识别dockerfile,但对我来说,它根本不起作用。但是我想退后的方法是
新构建

    oc new-build