OKD 4.0.0 with Docker: the one-liner edition


To run OKD 4.0.0 (from the master branch) with the Openshift console plus the operator-lifecycle-manager:

docker run --name oc-cluster-up -it -p 9000:9000 -v /tmp/:/tmp/ -v /var/run/docker.sock:/var/run/docker.sock gustavonalle/oc-cluster-up

then go to http://localhost:9000 using credentials “system/admin”

Long Story

In the previous post, we’ve seen a list of instructions to checkout OKD from sources, build it, run a Docker in Docker cluster with the console.

Although it’s a workable solution to run an environment to test and develop, it’s not as convenient as a one-liner.

The gustavonalle/oc-cluster-up was created to do all the work, still relying on Docker-in-Docker to launch an OKD cluster with a master and two nodes.

WARNING: The console uses OAUTH and so far it only works for Linux hosts, since MacOS native docker cannot access containers by IP.

The container itself starts other containers (via mapped /var/run/docker.sock), so it’s a mix of Docker-in-Docker and Docker-outside-Docker.

To build the console, it makes use of multi-stage Docker builds, reusing the Openshift console builder image to produce a distribution of the console.


WARNING: In the first time the container is run, it will build OKD dind images, don’t panic, it takes a while. Subsequent runs usually takes less than a minute to have a full cluster up and running.

Once the cluster is started, oc can be used from running directly in the openshift-master container:

docker exec -it openshift-master oc new-app jboss/infinispan-server

It’s also possible to interact with the cluster by using oc outside the containers, just export the environment variable:

export KUBECONFIG=/tmp/openshift-dind-cluster/openshift/openshift.local.config/master/admin.kubeconfig

And then run commands normally:

oc get all --all-namespaces


To clean-up, remember to first stop the sibling containers before killing gustavonalle/oc-cluster-up itself:

docker exec oc-cluster-up hack/dind-cluster.sh stop

The configuration files are saved in the /tmp directory of the host, under /tmp/openshift and /tmp/openshift-dind-cluster, so a full cleaning would involve deleting those as well.


The image is available on Dockerhub and the sources on Github. Give it a try and let me know if something is not right.