Setting up a Local Development Environment for OpenShift

OpenShift logo
OpenShift logo

So you are using OpenShift as your target platform (great choice!), but you need a local development environment? There is a lot of value in being able to run and test your application locally. With OpenShift this can be a bit of a challenge if you don’t know what’s out there. This blog post is intended to help offer some guidance to you.

There are a number of potential ways to go. The following is my recommendation based on experience and personal opinion.

Local development options

In my opinion, there are 3 rough options, in order of preference:

  1. Code Ready Containers (CRC): A minimal but complete OpenShift stack locally
  2. Podman (native on Linux, VM for other platforms): Podman is a daemon-less container runtime that supports OpenShift Pods and Deployment YAML directly
  3. Docker: Docker will run containers but doesn’t support Pods or Deployments, so you are limited to running containers only (no testing OpenShift config locally)
Logos for OpenShift, Podman, and Docker
Logos for OpenShift, Podman, and Docker
OpenShift, Podman, and Docker

Generally speaking, regardless of your OS of choice, if you have a big enough machine to support Code Ready Containers (CRC), that’s the way to go. I wouldn’t try to run it on a machine with less than 32 GB RAM and 8 cores. If your machine is smaller than this, I would recommend using Podman. If Podman won’t work for some reason, Docker won’t support Pods and Deployments, which means you can’t test your YAML locally, but it will let you run containers.

Now that you know your options and have made a choice, let’s get your environment set up!

Below are some helpful instructions to get started, based on your operating system.

Setting up your Development environment

Windows

Windows 10 Logo
Windows 10 Logo

CRC

You can download the installer and any assets (like a pull secret) here: https://cloud.redhat.com/openshift/install/crc/installer-provisioned

There are full installation instructions on the CRC docs site: https://code-ready.github.io/crc/#installation_gsg

Once CRC is installed, you can find usage instructions here: https://code-ready.github.io/crc/#using-codeready-containers_gsg

Podman

WSL2

The preference would be to use Windows Subsystem for Linux v2 (WSL2) to run Podman. There are some good instructions available here: https://www.redhat.com/sysadmin/podman-windows-wsl2

VirtualBox with Fedora

If WSL2 won’t work for you, the next best thing would be a Virtual Machine (VM). There are a few different products you can use, but an easy and free one is VirtualBox.

For Linux distribution, I would recommend installing Fedora Workstation as your distro of choice due to it’s easy integration with Podman. If you are comfortable working with headless VMs, you’ll get a lighter-on-resources machine using Fedora Server, but there won’t be a GUI to help you if you use Server instead of Workstation.

I prefer to install from an ISO file, but you can find VM images (such as qcow2 or VDI) for various hypervisors if you prefer that method.

Now install Podman inside your VM

Now that you have a Linux environment, follow the instructions for installing Podman on your distro of choice below.

Docker

Please refer to the Docker for Windows installation instructions

macOS

macOS Logo
macOS Logo
macOS

CRC

You can download the installer and any assets (like a pull secret) here: https://cloud.redhat.com/openshift/install/crc/installer-provisioned

There are full installation instructions on the CRC docs site: https://code-ready.github.io/crc/#installation_gsg

Once CRC is installed, you can find usage instructions here: https://code-ready.github.io/crc/#using-codeready-containers_gsg

Podman

Podman has binary builds for macOS, but they aren’t super useful as they are only a frontend. You can read more about that on Podman’s install page

A better way is to install a Linux distro in a Virtual Machine (VM). There are a few different products you can use, but an easy and free one is VirtualBox.

For Linux distribution, I would recommend installing Fedora Workstation as your distro of choice due to it’s easy integration with Podman. If you are comfortable working with headless VMs, you’ll get a lighter-on-resources machine using Fedora Server, but there won’t be a GUI to help you if you use Server instead of Workstation.

I prefer to install from an ISO file, but you can find VM images (such as qcow2 or VDI) for various hypervisors if you prefer that method.

Now install Podman inside your VM

Now that you have a Linux environment, follow the instructions for installing Podman on your distro of choice below.

Docker

Please refer to the Docker for macOS installation instructions

Linux

Fedora, RHEL, and CentOS Logos
Fedora, RHEL, and CentOS Logos
Fedora, RHEL, or CentOS

Fedora/RHEL/CentOS

CRC

You can download the installer and any assets (like a pull secret) here: https://cloud.redhat.com/openshift/install/crc/installer-provisioned

There are full installation instructions on the CRC docs site: https://code-ready.github.io/crc/#installation_gsg

Once CRC is installed, you can find usage instructions here: https://code-ready.github.io/crc/#using-codeready-containers_gsg

Podman

Congrats! This is the easiest path. Just install Podman and you’re done:

sudo dnf install podman

Docker

Please refer to the Docker for Fedora installation instructions or the Docker for CentOS instructions.

Ubuntu

CRC

You can download the installer and any assets (like a pull secret) here: https://cloud.redhat.com/openshift/install/crc/installer-provisioned

There are full installation instructions on the CRC docs site: https://code-ready.github.io/crc/#installation_gsg

Once CRC is installed, you can find usage instructions here: https://code-ready.github.io/crc/#using-codeready-containers_gsg

Podman

You can use the OpenSuse build system

As of November 6th, 2020, these are the instructions. I recommend consulting the Podman Ubuntu Installation documentation, but for convenience, here they are:

. /etc/os-release
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key | sudo apt-key add -
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install podman

Docker

Please refer to the Docker for Ubuntu installation instructions

Ben Porter is a Linux and open source advocate, currently working as an OpenShift consultant for Red Hat.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store