'docker: command not found

I am running Jenkins on Openshfit using Catalog, however, after creating my pipeline, I am getting Docker build failed

  • docker build -t biloocabba/kncare:2 . /var/lib/jenkins/jobs/KnCare-prod/workspace@tmp/durable-8e36408e/script.sh: line 1: docker: command not found
  • I was trying to access the Pod as root and install docker from there but not possible. scc showing restricted mode.

  • Any idea how to Edite the yml file to get the pod to run with root privileges



Solution 1:[1]

First , you should not run pod as root user because it can compromise whole openshift cluster security . Its not best practice to run as root user.

I would suggest using docker build config or jenkins pipeline strategy to build images in oenshift jenkins.

Still if you want to run your pod as root user , then follow the below steps :

  1. create a service account in your namespace

  2. add the service account to "anyuid" scc

  3. then run your pod with this service account.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Manmohan Mittal