Issue
- We need some tools installed on the Docker image that we use for agents.
- We have some scripts that we execute on every build.
Environment
- CloudBees Jenkins Enterprise (CJE) - AWS/OpenStack/Anywhere
Resolution
You want to have a new Palace template with some additional software installed. In order to do that, you need to create a new Docker image. Your starting point can be any Dockerfile
extending FROM
any of the Docker images shown below:
openjdk
cloudbees/java-with-docker-client
maven:3.3-jdk-8
If you are using a Palace Template that you want to use as base, you can find the Docker image used on its configure page, under the image field
Once you have chosen the base image (e.g. cloudbees/java-with-docker-client
) you have to create a Dockerfile
for it. Please, review the sample below where we install subversion, curl ,and htop
FROM cloudbees/java-with-docker-client:latest
USER root
RUN apt-get update -y
RUN apt-get install -y subversion curl htop
When you have the Dockerfile
you must push the image to your Docker Registry. Once that you have done it, you could use it on a Palace template.
Private Registry
To use a private registry in a Palace template, review Using private Docker registries.
Amazon ECR
If using Amazon ECR as registry, the following instructions are needed because it requires credentials rotation, so this operation sets it up on workers.
If using an AWS IAM profile, first make sure that the proper rights are set.
To update the ECR configuration, use the ecr-update
operation.
$ cje prepare ecr-update
ecr-update is staged - review ecr-update.config and edit as needed - then run 'cje apply' to perform the operation.
Edit the ecr-update.config
file to define the parameters you want to change.
This operation allows to: (see ecr-update.config
file for a complete list of parameters)
- Enable usage of the default AWS EC2 Container Registry
- Enable AWS EC2 Container Registry for specific accounts
Then you use the regular docker tag prefixed by the name of the ecr registry you wish to use (e.g. aws_account_id.dkr.ecr.region.amazonaws.com/my-org/my-image:my-version
); and you must reference docker.tar.gz
containing credentials as documented on Using private Docker registries in your docker template.
References
For more details on how to configure a Palace template, please review the links below.
CloudBees Jenkins Enterprise CD as Services
Tested products/plugins version
The latest update of this article was tested with:
0 Comments