Chandan Rajpurohit

An Artist With Technical Skills

Advertisements

The Jenkins project provides a Linux container image, not a Windows container image. Be sure that your Docker for Windows installation is configured to run Linux Containers rather than Windows Containers. See the Docker documentation for instructions to switch to Linux containers. Once configured to run Linux Containers, the steps are:

  1. Open up a command prompt window and do the following:
  2. Create a bridge network in Docker
    docker network create jenkins
  3. Run a docker:dind Docker image
    docker run --name jenkins-docker --rm --detach --privileged --network jenkins --network-alias docker --env DOCKER_TLS_CERTDIR=/certs --volume jenkins-docker-certs:/certs/client --volume jenkins-data:/var/jenkins_home docker:dind
  4. Customise official Jenkins Docker image, by executing below two steps:
    1. Create Dockerfile with the following content:
      FROM jenkins/jenkins:2.289.2-lts-jdk11 USER root RUN apt-get update && apt-get install -y apt-transport-https \ ca-certificates curl gnupg2 \ software-properties-common RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - RUN apt-key fingerprint 0EBFCD88 RUN add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/debian \ $(lsb_release -cs) stable" RUN apt-get update && apt-get install -y docker-ce-cli USER jenkins RUN jenkins-plugin-cli --plugins "blueocean:1.24.7 docker-workflow:1.26"
    2. Build a new docker image from this Dockerfile and assign the image a meaningful name, e.g. “myjenkins-blueocean:1.1”:
      docker build -t myjenkins-blueocean:1.1 .

      Note: – Keep in mind that the process described above will automatically download the official Jenkins Docker image if this hasn’t been done before.
  5. Run your own myjenkins-blueocean:1.1 image as a container in Docker using the following docker run command:
    docker run --name jenkins-blueocean --rm --detach --network jenkins --env DOCKER_HOST=tcp://docker:2376 --env DOCKER_CERT_PATH=/certs/client --env DOCKER_TLS_VERIFY=1 --volume jenkins-data:/var/jenkins_home --volume jenkins-docker-certs:/certs/client:ro --publish 8080:8080 --publish 50000:50000 myjenkins-blueocean:1.1
Advertisements

2 responses to “Jenkins Setup Using Docker On Windows”

Leave a Reply

%d bloggers like this: