Note: As of May 2022, Red Hat CodeReady Containers is now Red Hat OpenShift Local. Read about the changes here: Developer tools rebrand, say farewell to CodeReady name
Red Hat CodeReady Containers brings a minimal, preconfigured Red Hat OpenShift 4.1 or newer cluster to your local laptop or desktop computer for development and testing purposes. CodeReady Containers supports native hypervisors for Linux, macOS, and Windows 10.
In this article, we’ll look at the features and benefits of CodeReady Containers, show a demo of how easy it is to create a local Red Hat OpenShift 4 cluster, and show how to deploy an application on top of it.
CodeReady Containers requires the following minimum system resources to run Red Hat OpenShift:
- 4 virtual CPUs (vCPUs)
- 8 GB of memory
- 35 GB of storage space
You will also require the native hypervisor for your host operating system. CodeReady Containers currently supports libvirt for Linux, HyperKit for macOS, and Hyper-V for Windows.
Here's a brief walk-through of getting the bits, all the way through getting an app deployed.
Download & install
You can download CodeReady Containers from the Red Hat CodeReady Containers product page. To install CodeReady Containers, extract the downloaded archive its contents, and add the extracted
crc binary to your
PATH environment variable. On Linux and macOS, you can extract the contents of the
.tar.xz archive using the
tar xvf command.
Once CodeReady Containers has been installed, set up your host environment with the
crc setup command. This command must be run before starting the OpenShift cluster. This command should be run with your regular user account but will request elevated privileges when modifications are needed. Ensure that your user account is capable of elevating privileges.
$ crc setup
Start your OpenShift 4 cluster
After your host environment has been set up with the
crc setup command, you can start the OpenShift cluster with the
crc start command. When prompted, supply your user pull secret for the cluster. Your user pull secret can be copied or downloaded from the the Red Hat CodeReady Containers product page under the Pull Secret section. A Red Hat account is required to access the user pull secret.
$ crc start
You should now have a running Red Hat OpenShift 4 cluster in no time.
Using your cluster
CodeReady Containers includes a cached OpenShift client binary (
oc). You can use this cached
oc binary to interact with the running OpenShift cluster by running the
crc oc-env command and following the printed instructions. Once the environment has been set up to use the cached
oc binary, you can log in to the cluster as the
developer user, as follows:
$ eval $(crc oc-env) $ oc login -u developer -p developer
Now we’ll create a sample
httpd application deployment. Once you are logged in with
oc, create a new project:
$ oc new-project myproject
httpd example application:
$ oc new-app httpd-example
Monitor the status of your build to ensure it pushes successfully:
$ oc logs -f bc/httpd-example [...] Writing manifest to image destination Storing signatures Push successful
Once the push is successful, get the route to your application and ensure it is functioning properly:
$ oc get routes NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD httpd-example httpd-example-myproject.apps-crc.testing httpd-example <all> None $ curl -Ik httpd-example-myproject.apps-crc.testing HTTP/1.1 200 OK [...]
Congratulations, you now have a sample
httpd application running on Red Hat OpenShift 4!
You can also use
odo, a developer-focused command-line interface for OpenShift, to interact with the OpenShift cluster provided by CodeReady Containers.
For more information about CodeReady Containers, see the official CodeReady Containers documentation. Also, see the video below for a hands-on look.
If you encounter any issues using CodeReady Containers, see the Troubleshooting Red Hat CodeReady Containers guide. If this does not resolve your issue, create a bug in Bugzilla with the ‘crc’ component.
For community discussion, join the #codeready IRC channel on Freenode.
Many thanks to the CodeReady Container development team, members of the Red Hat OpenShift development team and blog writers/reviewers Kevin Owen, Gerard Braad, Praveen Kumar, and all.Last updated: September 19, 2023