Skip to content

docker configuration

devonfw-core edited this page Sep 29, 2021 · 2 revisions

Docker Configuration

Introduction

Docker is the most popular container technology. It allows you to build your application in an image and then deploy it into a container.

Overview

This template allow you to configure Jenkins in order to work with docker.

It will:

  • Add docker client as custom tool.

  • Configure docker to work with an external docker dameon.

Prerequisites

In order to execute this template, you need the following plugins installed in your Jenkins:

The initialize instance template will install all plugins if you select 'Docker' or 'Docker+Openshift' in the installDeploymentPlugins parameter

Template

This template will be automatically created in your jenkins after executing the Initialize_Instance template inside the UTILS folder with the name Docker_Configuration.

For manual creation see: How to add a Template

This template needs the devonfw Production Line Shared Lib

Parameters

The only parameter required is remote docker daemon URL. Example: tcp://127.0.0.1:2367

You need to expose the docker daemon manually in your machine. Here you can find how to do it
⚠️
This configuration requires that the docker daemon has no security. It’s prepared for development environments, for production environments please add security to your docker daemon.

Execution

  1. Press the Build with Parameters button

  2. Insert remote docker daemon URL.

  3. Press the Build button.

  4. Wait until the pipeline ends.

docker configuration
docker configuration2

Then, you can see that the docker is configured and the remote docker daemon environment variable is set:

docker env var
docker custom tool

The environment variable is configured globally, if you want to use another remote docker daemon for a specific build, you can override the DOCKER_HOST environment variable in your job.

If the DOCKER_HOST is already configured globally, when you execute again this template the value will not be changed. You need to change the value manually at: Jenkins → Manage Jenkins → Configure System → Global properties