How to install the openshift on MAC docker

How to install the openshift on MAC docker

Full official document

https://github.com/openshift/origin/blob/master/docs/cluster_up_down.md

My own step:

step: 1 install Docker and set "insecure-registry"

Install Docker for Mac making sure you meet the prerequisites and download a compatible version of Docker.

  1. Once Docker is running, add an insecure registry of172.30.0.0/16:
1. From the Docker menu in the toolbar, select
2. "Preferences..."
3. Click on "Daemon"
4. In the preferences dialog 
    (note: on some older versions of Docker for Mac this is under "Advanced")
5. Under "Insecure registries": 
6. click on the "+", icon to add a new entry, Enter "172.30.0.0/16" and press "return"
7. Click on "Apply and Restart"

Here is the example (step 1-3)

Here is the example (step 4-7)

Install the openshift.

  1. Install the oc binary using homebrew with:brew install openshift-cli

    OR

    Download the OS Xocbinary fromopenshift-origin-client-tools-VERSION-mac.zipand place it in your path.

    Please be aware that the 'oc cluster' set of commands are only available in the 1.3+ or newer releases.

  2. Create a new docker machine namedopenshiftwith appropriate resource constraints. SeeGetting Started with Docker Machinefor instructions.

  3. Open Terminal and run

    $ docker-machine create openshift
    $ docker-machine start openshift
    

To start/stop OpenShift cluster:

  • Setup the Docker environment for the machine you wish to use, and then runoc cluster upandoc cluster down:

    $ eval $(docker-machine env openshift)
    $ oc cluster up
    
    ...
    
    $ oc cluster down
    

if you receive the following error, when run "oc cluster up ", please make you setup the "insecure registry" in step 1 and restarted your docker.

Ensure that the Docker daemon is running with the following argument:
         --insecure-registry 172.30.0.0/16

if you check the docker container such as run "docker container ls" , you will find 4 containers are running:

docker container ls

The container name :

  • router
  • registry_docker
  • webconsole
  • origin

How to start the web console :

  1. run "oc cluster up ".

  2. open the "browser" and default URL :

  3. Default URL :

https://127.0.0.1:8443/console

Default username and password

admin /password

After login, you can try the local "Openshift" for your development, enjoy

Remark:

useful oc command

$ oc cluster status
$ oc config view

official document:

https://docs.openshift.com/enterprise/3.0/cli_reference/get_started_cli.html

Etcd Data

To persist data across restarts, specify a valid host directory in the--host-data-dirargument when starting your cluster withoc cluster up. As long as the same value is specified every time, the data will be preserved across restarts.

If a host data directory is not specified, the data directory used by OpenShift is discarded when the container is destroyed.

  # Start OpenShift on a new docker machine named 'openshift'
  oc cluster up --create-machine

  # Start OpenShift using a specific public host name
  oc cluster up --public-hostname=my.address.example.com


  # Start OpenShift and preserve data and config between restarts
  oc cluster up --host-data-dir=/mydata --use-existing-config


  oc cluster up --host-data-dir=/usr/local/docker/mydata --use-existing-config

Here is my example

To persist data across restarts.

Step 1 : set the docker "File Sharing"

Step 2 : run the cluster up with "host data"

oc cluster up --host-data-dir=/usr/local/docker/openshift/mydata --use-existing-config

results for ""

    No results matching ""