Jenkins on Docker Toolbox – Windows 10

Posted: January 3, 2020 in Jenkins

Install Git for Windows

Install Virtual Box

Install Jenkins

Install Docker toolbox

Enable support for native Linux commands on Windows:

Add C:\Program Files\Git\usr\bin and C:\Program Files\Docker Toolbox to System PATH environment variable

Open CMD and type Docker-machine env default

You’ll get similar output:

SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://172.16.0.102:2376
SET DOCKER_CERT_PATH=C:\Users\dragan.vucanovic.docker\machine\machines\default
SET DOCKER_MACHINE_NAME=default
SET COMPOSE_CONVERT_WINDOWS_PATHS=true
REM Run this command to configure your shell:
REM @FOR /f "tokens=*" %i IN ('Docker-machine env default') DO @%i

Open Jenkins – Manage Jenkins – Configure System – Check Environment variables check box and add following variables:

  • DOCKER_CERT_PATH
  • DOCKER_HOST
  • DOCKER_MACHINE
  • DOCKER_TLS_VERIFY

Define docker command:

Jenkins – Global Tool configuration – Docker – Docker installation

Name: Docker

Installation root: C:\Program Files\Docker Toolbox

Restart Jenkins service

Now you should be able to deploy Docker images same way as in Linux system

stage('Build and Push Image') {
         steps {
           sh 'docker image build -t ${REPOSITORY_TAG} .'
         }
      }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s