How to run an ad-hoc interactive container
It is sometimes useful to be able to run a random container image for debugging inside a project.
oc run allows it by running in a single command:
$ oc run pod-name -it --rm --image=bash --restart=Never If you do not see a command prompt, try pressing enter. bash-4.2$
pod-namecan be any given name that does not exist already in the namespace.
octo create an interactive session.
--rmwill make the Pod to be deleted after the session is over.
--image=bashis the name of the image, in this case library/bash. It can be any given image, either public library image like
bash, or a pourpose build private image.
--restart=Neverwill tell OpenShift to not restart the Pod when the session is over.
Last edited Tue Apr 6 2021