Difficulty: intermediate
Estimated Time: 15-20 minutes


Learn how to copy files to and from a running container without rebuilding the container image. Augment this with a watch function that automatically applies local changes to a running container so you can immediately see the effects in your application.


  • Rapid inner-loop development by modifying a running container
  • OpenShift Projects and Applications
  • OpenShift oc tool’s new-app subcommand

Use case

You can modify an application in a container to develop and test before building a new version of the container's immutable image. Automatatically synchronizing the container with local changes speeds the "inner loop" of develop and test cycles, especially with interpreted programming languages.

This OpenShift cluster will self-destruct in one hour.

In this course you learned about oc commands you can use to transfer files to and from a running container, as well as how to set up live synchronization so changes are automatically copied from a local machine into a running container.

Continue Learning

You can continue learning more about OpenShift and how to develop applications on the platform by completing other tutorials at https://learn.openshift.com.

For developer-related resources about OpenShift, visit https://developers.redhat.com/products/openshift/getting-started.

Run OpenShift Locally with CodeReady Containers

CodeReady Containers allows you to run a minimal, pre-configured OpenShift 4 cluster on your local machine. The project supports Windows 10, macOS, and Linux. To find out more or download CodeReady Containers, visit https://developers.redhat.com/products/codeready-containers/overview

Compare Hosted, Managed, or On Premises OpenShift

Learn more about the different OpenShift platform variants here: https://www.openshift.com/try

Browse the Documentation

If you want to learn about particular OpenShift concepts in more depth, visit the documentation: https://docs.openshift.com/container-platform/latest

Transferring Files in and out of Containers

Step 1 of 5

Topic 1 - Creating an Initial Project

Before we get started, you need to login and create a project in OpenShift to work in.

To login to the OpenShift cluster used for this course from the Terminal, run:

oc login -u developer -p developer

This will log you in using the credentials:

  • Username: developer
  • Password: developer

You should see the output:

Login successful.

You don't have any projects. You can try to create a new project, by running

    oc new-project <projectname>

To create a new project called myproject run the command:

oc new-project myproject

You should see output similar to:

Now using project "myproject" on server "https://openshift:6443".

You can add applications to this project with the 'new-app' command. For example, try:

    oc new-app django-psql-example

to build a new example application in Python. Or use kubectl to deploy a simple Kubernetes application:

    kubectl create deployment hello-node --image=gcr.io/hello-minikube-zero-install/hello-node

We are not going to use the web console for this course, but if you want to check anything from the web console, switch to the Console and use the same credentials to login as you used above to login from the command line.