Which command creates a secret named regtoken from a docker config JSON file to access a private registry?

Prepare for the Red Hat OpenShift Developer II DO288 Exam with our quizzes. Study with flashcards and multiple choice questions, each with hints and explanations. Get ready for your certification!

Multiple Choice

Which command creates a secret named regtoken from a docker config JSON file to access a private registry?

Explanation:
Storing credentials for a private image registry as a dockerconfigjson secret is the concept here. Kubernetes/OpenShift expects a secret of type kubernetes.io/dockerconfigjson, with the secret data containing a single key named .dockerconfigjson whose value is the Docker config JSON. Using the --from-file option with the syntax key=value lets you place the file contents under that exact key. In this example, the file at ${XDG_RUNTIME_DIR}/containers/auth.json is read and stored under the .dockerconfigjson key, and the secret is explicitly labeled as kubernetes.io/dockerconfigjson so image-pull operations know how to use it. With regtoken created this way, you can reference it in a service account or pod as an imagePullSecrets to access the private registry.

Storing credentials for a private image registry as a dockerconfigjson secret is the concept here. Kubernetes/OpenShift expects a secret of type kubernetes.io/dockerconfigjson, with the secret data containing a single key named .dockerconfigjson whose value is the Docker config JSON. Using the --from-file option with the syntax key=value lets you place the file contents under that exact key. In this example, the file at ${XDG_RUNTIME_DIR}/containers/auth.json is read and stored under the .dockerconfigjson key, and the secret is explicitly labeled as kubernetes.io/dockerconfigjson so image-pull operations know how to use it. With regtoken created this way, you can reference it in a service account or pod as an imagePullSecrets to access the private registry.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy