1 default root 806 Jul 6 11:57 manage.pyĠ drwxrwxr-x. 3 default root 93 Jul 6 12:01 katacodaĤ -rwxrwxr-x.
2 default root 25 Jul 6 11:57 htdocsĠ drwxrwxr-x. 1 default root 430 Jul 6 11:57 DockerfileĠ drwxrwxr-x. 1 default root 284 Jul 6 11:57 app.shĠ drwxrwxr-x. You should receive some output similar to this: total 72Ġ drwxrwxrwx. To create an interactive shell within the same container running the application, you can use the oc rsh command, supplying it the environment variable holding the name of the pod.įrom within the interactive shell, see what files exist in the application directory. As you saw above, in this case, the pod would be blog-1-9j3p3. You only have one instance of the application, so only one pod will be listed, looking something like this: NAME READY STATUS RESTARTS AGEįor subsequent commands which need to interact with that pod, you'll need to use the name of the pod as an argument. You can see the name of the pods corresponding to the running containers for this application by running: This command will exit once the deployment has completed and the web application is ready. We can also monitor the deployment of the application by running: To access it from a web browser, we also need to expose it by creating a Route: Oc new-app openshiftkatacoda/blog-django-py -name blog To demonstrate transferring files to and from a running container, we first need to deploy an application. We're not going to be using the web console, but you can check the status of your project there if you wish. You'll be using just the oc command line tool.
In this post, we're going to cover how to transfer files between your local machine and a running container.īefore starting, make sure that you're logged into your OpenShift cluster through the terminal and have created a project. During development, these may be data files or log files created by the application. In addition to uploading files into a running container, you might also want to download files.
By being able to modify code in the container, you can modify the application to test changes before rebuilding the image. One example of where this might be done is during development when a dynamic scripting language is being used. When a new container is started from the same container image, it reverts back to what was originally built into the image.Īlthough any changes to the local container file system are discarded when the container is stopped, it can sometimes be convenient to be able to upload files into a running container. That is, although you can make changes to the local container file system of a running image, the changes are not permanent. One of the properties of container images is that they are immutable. Finally, in part three, we’ll cover copying files into a new persistent volume. Part two will be about live synchronization. In this post, we’ll cover manually copying files into and out of a container. Transferring Files In and Out of Containers in OpenShift