0

I'm running Jenkins version 2.176.3 on Openshift online. And I want to build a pipeline which uses Docker commands to build the image. When I tried to build it gives me an error saying Docker command not found.

I think that is because I don't have Docker installed in Jenkins. I tried to do that using the Jenkins Plugin Manager but the Docker plugin requires Jenkins version 2.19 or later.

I also tried accessing the Jenkins container using oc CLI and tried to install Docker but did not work.

So what would be the best method for me to install Docker inside Jenkins?

Thisara Watawana
  • 344
  • 4
  • 15
  • you can see [docker-inside-docker-for-jenkins](https://itnext.io/docker-inside-docker-for-jenkins-d906b7b5f527) – myeongkil kim Dec 07 '20 at 06:30
  • simple example) docker run -it -v /var/run/docker.sock:/var/run/docker.sock ubuntu:latest sh -c "apt-get update ; apt-get install docker.io -y ; bash" – myeongkil kim Dec 07 '20 at 06:31
  • I'm sorry this could be a stupid question. But where I use this exactly? Inside my Jenkinsfile? So I'm using Openshift online and my repository has a Jenkinsfile. And when I create a new application Openshift automatically detects the Jenkinsfile and run a pipeline build. – Thisara Watawana Dec 07 '20 at 07:18
  • All questions are meaningful and not stupid. It's okay to have confidence. [openshift-docker-strategy](https://docs.openshift.com/enterprise/3.0/admin_guide/securing_builds.html) see this document, very details, you can! – myeongkil kim Dec 07 '20 at 07:49

1 Answers1

0

The error means you need to have/install docker inside your agent/slave image. For a test purpose try to run your pipeline with docker images, which already contain docker tool.

Dmitriy Tarasevich
  • 1,082
  • 5
  • 6