Openshift& docker - 我可以将哪个注册表用于Minishift?

时间:2018-06-09 17:20:02

标签: docker openshift minishift

使用Openshift作为服务容器很容易,请参阅detailed steps。所以,通过docker客户端,我可以使用Openshift。

我想用Minishift在我的笔记本电脑上工作。这是您笔记本电脑上本地版本的Openshift。

我应该将哪个docker注册表与Minishift结合使用? Minishift没有它自己的注册表 - 我猜。

所以,我想这样做:

$ maven clean install -- building the application
$ oc login to your minishift environment
$ docker build -t myproject/mynewapplication:latest
$ docker tag -- ?? normally to a openshift docker registry entry
$ docker push -- ?? to a local docker registry?
$ on 1st time: $ oc new-app mynewapplication
$ on updates: $ oc rollout latest dc/mynewapplication-n myproject

2 个答案:

答案 0 :(得分:4)

我只使用docker和oc cluster up非常相似。部署的内部注册表在172.30.0.0/16空间(即默认服务网络)中具有一个地址。

$ oc login -u system:admin
$ oc get svc -n default  | grep registry
docker-registry   ClusterIP   172.30.1.1     <none>        5000/TCP                  14m

现在,此服务IP是群集内部的,但它可以在路由器上公开:

$oc expose svc docker-registry -n default
$oc get route -n default  | grep registry
docker-registry   docker-registry-default.127.0.0.1.nip.io             docker-registry   5000-tcp                 None

在我的示例中,路线为docker-registry-default.127.0.0.1.nip.io

使用此路线,您可以使用您的开发者帐户和令牌

登录
$oc login -u developer
$docker login docker-registry-default.127.0.0.1.nip.io -p $(oc whoami -t) -u developer
Login Succeeded

注意:默认情况下oc cluster up是短暂的;文档可以提供有关如何使此设置持久的说明。

另外需要注意的是,如果您希望OpenShift尝试使用其中的一些本机构建器,则只需在源代码目录中运行oc new-app . --name <appname>即可。

$ cat Dockerfile 
FROM centos:latest

$ oc new-app . --name=app1
--> Found Docker image 49f7960 (5 days old) from Docker Hub for "centos:latest"

    * An image stream will be created as "centos:latest" that will track the source image
    * A Docker build using binary input will be created
      * The resulting image will be pushed to image stream "app1:latest"
      * A binary build was created, use 'start-build --from-dir' to trigger a new build
    * This image will be deployed in deployment config "app1"
    * The image does not expose any ports - if you want to load balance or send traffic to this component
      you will need to create a service with 'expose dc/app1 --port=[port]' later
    * WARNING: Image "centos:latest" runs as the 'root' user which may not be permitted by your cluster administrator

--> Creating resources ...
    imagestream "centos" created
    imagestream "app1" created
    buildconfig "app1" created
    deploymentconfig "app1" created
--> Success
    Build scheduled, use 'oc logs -f bc/app1' to track its progress.
    Run 'oc status' to view your app.

答案 1 :(得分:2)

有一个内部图像注册表。您登录并按照您的建议推送图像。您只需要知道所需的地址和凭据。详情请见: