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

tm1*_*701 2 openshift docker minishift

将Openshift用作容器即服务很容易,请参阅详细步骤。因此,通过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
Run Code Online (Sandbox Code Playgroud)

ste*_*hea 6

我只使用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
Run Code Online (Sandbox Code Playgroud)

现在,此服务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
Run Code Online (Sandbox Code Playgroud)

在我的示例中,路线为 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
Run Code Online (Sandbox Code Playgroud)

注意: 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.
Run Code Online (Sandbox Code Playgroud)