Skip to content

cluster up: add registry instructions #12826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 73 additions & 14 deletions docs/cluster_up_down.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- [Etcd Data](#etcd-data)
- [Routing](#routing)
- [Specifying Images to Use](#specifying-images-to-use)
- [Accessing the OpenShift Registry Directly](#accessing-the-openshift-registry-directly)

## Pre-requisites

Expand All @@ -28,10 +29,10 @@
## Overview

The `oc cluster up` command starts a local OpenShift all-in-one cluster with a configured registry, router, image streams, and default templates.
By default, the command requires a working Docker connection. However, if running in an environment with
By default, the command requires a working Docker connection. However, if running in an environment with
[Docker Machine](https://docs.docker.com/machine) installed, it can create a Docker machine for you.

The `oc cluster up` command will create a default user and project and, once it completes, will allow you to start using the
The `oc cluster up` command will create a default user and project and, once it completes, will allow you to start using the
command line to create and deploy apps with commands like `oc new-app`, `oc new-build`, and `oc run`. It will also print out
a URL to access the management console for your cluster.

Expand Down Expand Up @@ -131,8 +132,8 @@ $ oc cluster down
$ oc cluster up --create-machine
```

A Docker machine named `openshift` will be created using the VirtualBox driver and the OpenShift cluster
will be started on it.
A Docker machine named `openshift` will be created using the VirtualBox driver and the OpenShift cluster
will be started on it.

To stop the cluster, run:

Expand Down Expand Up @@ -213,8 +214,8 @@ C:\> oc cluster down
C:\> oc cluster up --create-machine
```

A Docker machine named `openshift` will be created using the VirtualBox driver and the OpenShift cluster
will be started on it.
A Docker machine named `openshift` will be created using the VirtualBox driver and the OpenShift cluster
will be started on it.

To stop the cluster, run:

Expand Down Expand Up @@ -253,8 +254,8 @@ Once the machine has been created, the `--create-machine` argument is no longer
## Persistent Volumes

(Available starting origin release 1.5.0-alpha.2)
Cluster up creates a set of persistent volumes by default. It exposes a new
flag that allows setting the directory on the host for these volumes (`--host-pv-dir`). The registry and templates for
Cluster up creates a set of persistent volumes by default. It exposes a new
flag that allows setting the directory on the host for these volumes (`--host-pv-dir`). The registry and templates for
databases and jenkins will now default to persistent storage.

## Using a Proxy
Expand All @@ -273,8 +274,8 @@ Cluster up supports the following flags to specify a proxy:

Your Docker settings should mirror the cluster up settings for HTTP and HTTPS proxy. And if you do specify either of these,
You should at least add the registry service IP (172.30.1.1) to the Docker daemon's NO_PROXY environment variable.
How these settings are specified will vary depending on your platform. Both Docker for Windows and Docker for Mac provide a
settings GUI for specifying a proxy. On RHEL or Fedora, you can add HTTP_PROXY, HTTPS_PROXY, and NO_PROXY variables to
How these settings are specified will vary depending on your platform. Both Docker for Windows and Docker for Mac provide a
settings GUI for specifying a proxy. On RHEL or Fedora, you can add HTTP_PROXY, HTTPS_PROXY, and NO_PROXY variables to
/etc/sysconfig/docker (or /etc/sysconfig/docker-latest depending on which service you're using).
Cluster up will warn you if there is a discrepancy between the Docker settings and the arguments you specify for cluster up.

Expand Down Expand Up @@ -323,7 +324,7 @@ and either specify its name with the `--docker-machine` argument, or set its env
command. When creating a Docker machine manually, you must specify the `--engine-insecure-registry` argument with the
value expected by OpenShift.

Following are examples of creating a new Docker machine in OS X using the [xhyve](https://github.com/zchee/docker-machine-driver-xhyve) driver,
Following are examples of creating a new Docker machine in OS X using the [xhyve](https://github.com/zchee/docker-machine-driver-xhyve) driver,
and in Windows, using the [hyper-v](https://docs.docker.com/machine/drivers/hyper-v/) driver.

OS X:
Expand All @@ -345,7 +346,7 @@ on the current shell. Also if the machine exists but is not started, `oc cluster
To specify a different location for it, use the `--host-config-dir` argument. The host directory will be mounted
in the `origin` container at `/var/lib/origin/openshift.local.config`.

A new configuration will be generated by default each time the cluster is started. To make changes to the configuration and
A new configuration will be generated by default each time the cluster is started. To make changes to the configuration and
preserve those changes, use the `--use-existing-config` argument when starting your cluster.

If your client is not the Docker host, you can make a local copy of the configuration with Docker cp:
Expand All @@ -370,10 +371,10 @@ To use a different suffix, specify it with `--routing-suffix`.

By default `oc cluster up` uses `openshift/origin:[released-version]` as its OpenShift image (where [released-version]
corresponds to the release of the `oc` client) and `openshift-origin-${component}:[released-version]` for
other images created by the OpenShift cluster (registry, router, builders, etc). It is possible to use a different set of
other images created by the OpenShift cluster (registry, router, builders, etc). It is possible to use a different set of
images by specifying the version and/or the image prefix.

To use a different version of Origin, specify the --version argument. In the following example, images named
To use a different version of Origin, specify the --version argument. In the following example, images named
openshift/origin:v1.1.6, openshift/origin-router:v1.1.6, etc. will be used for your cluster.
```
oc cluster up --version=v1.1.6
Expand All @@ -386,3 +387,61 @@ oc cluster up --image=myregistry.example.com/ose/origin
```

Both --version and --image may be combined to specify the image name prefix and tag for the images to use.

## Accessing the OpenShift Registry Directly

On cluster startup, cluster up creates an OpenShift registry by default. The registry can be accessed directly
via docker commands by using its service IP address.

> Starting with release v1.5.0-alpha.2, the service IP of the registry is fixed at `172.30.1.1`

To determine the service IP of the registry (if using a client prior to v1.5.0-alpha.2):

1. Login as system:admin
```
oc login -u system:admin
```

2. Get the registry service from the default namespace
```
oc get svc docker-registry -n default
```

3. Log back in as your regular user
```
oc login -u developer
```

To push arbitrary images from your local Docker daemon to this registry, you will need to:

1. Obtain your OpenShift token and store it in a variable
```
OPENSHIFT_TOKEN=$(oc whoami -t)
```

2. Login to the registry
(Substitute the registry service IP for 172.30.1.1 if different on your system)
```
docker login -u developer -p ${OPENSHIFT_TOKEN} 172.30.1.1:5000
```

3. Tag an image with your registry and namespace, and push it.

An image tag must be of the format `REGISTRY_IP:5000/NAMESPACE/name[:TAG]`

where REGISTRY_IP is the IP of your registry, NAMESPACE is an OpenShift namespace that
you have access to, and TAG is an optional tag that you want to create for the image.

After an image is pushed, an ImageStream is automatically created for it in the namespace
that you used to tag it.

Following is an example of pulling an nginx image and pushing it to your local namespace

```
docker pull nginx:latest
docker tag nginx:latest 172.30.1.1:5000/myproject/nginx:latest
docker push 172.30.1.1:5000/myproject/nginx:latest
```

After the image is pushed to the local registry, an ImageStream named `nginx` will be
created in the `myproject` namespace.