Currently we have many requests to support customers in running PostgreSQL in Docker containers. Some of those use redhat OpenShift as the management platform for their Docker deployments. Setting up an OpenShift cluster requires quite some resources and is nothing you want to do on your workstation usually. To overcome that you can use MiniShift which launches a one node OpenShift cluster which you can use for testing. Setting that up is quite easy.

Obviously MiniShift needs to be downloaded. I’ll be running MiniShift on my workstation and will use VirtualBox as the Hypervisor for Minishift:

[email protected]:~$ sudo mkdir /opt/minishift
[sudo] password for dwe: 
[email protected]:~$ sudo chown dwe:dwe /opt/minishift
[email protected]:~$ cd /opt/minishift
[email protected]:/opt/minishift$ wget
[email protected]:/opt/minishift$ tar -axf minishift-1.16.1-linux-amd64.tgz
[email protected]:/opt/minishift$ cd minishift-1.16.1-linux-amd64/
[email protected]:/opt/minishift/minishift-1.16.1-linux-amd64$ export PATH=/opt/minishift/minishift-1.16.1-linux-amd64:$PATH
[email protected]:/opt/minishift/minishift-1.16.1-linux-amd64$ minishift config set vm-driver virtualbox
No Minishift instance exists. New 'vm-driver' setting will be applied on next 'minishift start'

Now MiniShift can be started:

[email protected]:/opt/minishift/minishift-1.16.1-linux-amd64$ minishift start

The output should look similar to this:

-- Starting profile 'minishift'
-- Checking if is reachable (using proxy: "No") ... OK
-- Checking if requested OpenShift version 'v3.9.0' is valid ... OK
-- Checking if requested OpenShift version 'v3.9.0' is supported ... OK
-- Checking if requested hypervisor 'virtualbox' is supported on this platform ... OK
-- Checking if VirtualBox is installed ... OK
-- Checking the ISO URL ... OK
-- Downloading OpenShift binary 'oc' version 'v3.9.0'
 42.11 MiB / 42.11 MiB [========================================================================================================================] 100.00% 0s-- Downloading OpenShift v3.9.0 checksums ... OK
-- Checking if provided oc flags are supported ... OK
-- Starting local OpenShift cluster using 'virtualbox' hypervisor ...
-- Minishift VM will be configured with ...
   Memory:    2 GB
   vCPUs :    2
   Disk size: 20 GB

   Downloading ISO ''
 40.00 MiB / 40.00 MiB [========================================================================================================================] 100.00% 0s
-- Starting Minishift VM ........................... OK
-- Checking for IP address ... OK
-- Checking for nameservers ... OK
-- Checking if external host is reachable from the Minishift VM ... 
   Pinging ... OK
-- Checking HTTP connectivity from the VM ... 
   Retrieving ... OK
-- Checking if persistent storage volume is mounted ... OK
-- Checking available disk space ... 0% used OK
   Importing 'openshift/origin:v3.9.0' . CACHE MISS
   Importing 'openshift/origin-docker-registry:v3.9.0'  CACHE MISS
   Importing 'openshift/origin-haproxy-router:v3.9.0'  CACHE MISS
-- OpenShift cluster will be configured with ...
   Version: v3.9.0
Pulling image openshift/origin:v3.9.0
Pulled 1/4 layers, 26% complete
Pulled 2/4 layers, 72% complete
Pulled 3/4 layers, 82% complete
Pulled 4/4 layers, 100% complete
Image pull complete
Using Docker shared volumes for OpenShift volumes
Using as the server IP
Starting OpenShift using openshift/origin:v3.9.0 ...
OpenShift server started.

The server is accessible via web console at:

You are logged in as:
    User:     developer

To login as administrator:
    oc login -u system:admin

-- Exporting of OpenShift images is occuring in background process with pid 7708.

You should also see a new VM in VirtualBox:

As we will need the oc binary to work with OpenShift we need to add that to the PATH:

[email protected]:/opt/minishift/minishift-1.16.1-linux-amd64$ minishift oc-env
export PATH="/home/dwe/.minishift/cache/oc/v3.9.0/linux:$PATH"
# Run this command to configure your shell:
# eval $(minishift oc-env)
[email protected]:/opt/minishift/minishift-1.16.1-linux-amd64$ eval $(minishift oc-env)
[email protected]:/opt/minishift/minishift-1.16.1-linux-amd64$ which oc

And we are ready to use OpenShift:

oc login -u system:admin
Logged into "" as "system:admin" using existing credentials.

You have access to the following projects and can switch between them with 'oc project ':

  * edb

Using project "edb".

The web interface is up and running is well:

Logging in as system/admin:

… we could already start and deploy a PostgreSQL container but this is the topic for the next post. To stop MiniShift:

[email protected]:~$ minishift stop
Stopping local OpenShift cluster...
Cluster stopped.

Hope that helps.

Thumbnail [60x60]
Daniel Westermann