Debug Container with Oracle Instantclient

GitLab: c2platform/docker/debug 

This Dockerfile sets up a Debug Container based on the UBI7 image from the Red Hat registry with Oracle Instantclient and some other useful tools installed. This container is intended to be used for debugging purposes in OpenShift. The project is hosted on GitLab  and has a pipeline  that creates an image in the Container Registry  of the project each time a change is pushed. Commits on the master branch are published as “latest”, and git tags are published as image tags.

The provided code snippet below shows how the container can be used in an OpenShift environment created using CodeReady Containers (CRC). It logs in to the OpenShift instance, creates a new project, pulls the image from the GitLab Container Registry, tags it, pushes it to the OpenShift instance, and starts a new container, allowing the user to access it with a bash terminal.

See also How-to CodeReady Containers (CRC)  .

export HOST=default-route-openshift-image-registry.apps-crc.testing
export CRC_NAMESPACE=debug-test
eval $(crc oc-env)
oc login -u developer -p developer https://api.crc.testing:6443 


oc project $CRC_NAMESPACE
docker login -u $(oc whoami) -p $(oc whoami -t) $HOST
docker pull registry.gitlab.com/c2platform/docker/debug
docker tag registry.gitlab.com/c2platform/docker/debug:latest $HOST/$CRC_NAMESPACE/debug:latest
docker push $HOST/$CRC_NAMESPACE/debug:latest
oc run debug --image=$HOST/$CRC_NAMESPACE/debug:latest
oc exec -it debug -- /bin/bash
Show me
user@ubuntu22:~$ export HOST=default-route-openshift-image-registry.apps-crc.testing
export CRC_NAMESPACE=debug-test
user@ubuntu22:~$ eval $(crc oc-env)
oc login -u developer -p developer https://api.crc.testing:6443 


Login successful.

You have access to the following projects and can switch between them with 'oc project <projectname>':

  * debug-test
    openshift

Using project "debug-test".
user@ubuntu22:~$ oc project $CRC_NAMESPACE
docker login -u $(oc whoami) -p $(oc whoami -t) $HOST
Already on project "debug-test" on server "https://api.crc.testing:6443".
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /home/ostraaten/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store 



Login Succeeded
user@ubuntu22:~$ docker pull registry.gitlab.com/c2platform/docker/debug
Using default tag: latest
latest: Pulling from c2platform/docker/debug
Digest: sha256:c0b0b5c8ddbc513be538eeb752a1bac8956b4248121d4576f7f3016c5dec6872
Status: Image is up to date for registry.gitlab.com/c2platform/docker/debug:latest
registry.gitlab.com/c2platform/docker/debug:latest
user@ubuntu22:~$ docker tag registry.gitlab.com/c2platform/docker/debug:latest $HOST/$CRC_NAMESPACE/debug:latest
user@ubuntu22:~$ docker push $HOST/$CRC_NAMESPACE/debug:latest
The push refers to repository [default-route-openshift-image-registry.apps-crc.testing/debug-test/debug]
df3bed598496: Layer already exists
e2b3bc13e9a7: Layer already exists
087497746b72: Layer already exists
a6d542167482: Layer already exists
latest: digest: sha256:c0b0b5c8ddbc513be538eeb752a1bac8956b4248121d4576f7f3016c5dec6872 size: 1158
user@ubuntu22:~$ oc run debug --image=$HOST/$CRC_NAMESPACE/debug:latest
pod/debug created
user@ubuntu22:~$ oc exec -it debug -- /bin/bash
bash-4.2$ sqlplus

SQL*Plus: Release 21.0.0.0.0 - Production on Wed Jan 25 09:45:25 2023
Version 21.8.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

Enter user-name: