Dockerfile customization

It is likely that you might need to customize your Docker file for certain scenarios, which include, but aren’t limited to:

  • Connecting to a proprietary database (DB2, Oracle, etc.)
  • Adding a hotfix as instructed by our support team
  • Adding a custom plugin

You can customize a Docker image for your needs as described in the process below.

Important: When you create a Dockerfile with custom resources added, always remember that the owning user:group combination must be 10001:0, or else, Deploy will not be able to read the files.

Note: Certain JARS should be placed in specific paths only. For example, you shouldn’t add a Oracle JAR to the ext/ folder. If you are unsure where a JAR should be added, please get in touch with our support team.

Note: ${APP_HOME} points to the path /opt/xebialabs/xl-deploy-server by default

To begin, create a Dockerfile that resembles the following configuration:

FROM xebialabs/xl-deploy:9.5.0

###################################################################################
# PLUGINS                                                                         #
# Plugins should be placed under ${APP_HOME}/default-plugins/ #
###################################################################################

COPY --chown=10001:0 files/xld-liquibase-plugin-5.0.1.xldp /opt/xebialabs/xl-deploy-server/default-plugins/

# Add plugin from url
ADD --chown=10001:0 https://dist.xebialabs.com/public/community/deploy/command2-plugin/3.9.1-1/command2-plugin-3.9.1-1.jar /opt/xebialabs/xl-deploy-server/default-plugins/

##########################################################################
# EXTENSIONS                                                             #
# Extensions should be placed under ${APP_HOME}/ext
##########################################################################
ADD --chown=10001:0 files/ext /opt/xebialabs/xl-deploy-server/ext/

##########################################################################
# HOTFIXES                                                               #
##########################################################################
ADD --chown=10001:0 files/lib-hotfix.jar /opt/xebialabs/xl-deploy-server/hotfix/lib/
ADD --chown=10001:0 files/plugin-hotfix.jar /opt/xebialabs/xl-deploy-server/hotfix/plugin/
ADD --chown=10001:0 files/sattelite-lib-hotfix.jar /opt/xebialabs/xl-deploy-server/hotfix/sattelite-lib/

##########################################################################
# LIBRARIES                                                              #
##########################################################################
ADD --chown=10001:0 files/ojdbc6.jar /opt/xebialabs/xl-deploy-server/lib/

Note: There are separate hotfix directories for placing different types of hotfix JARS. If you are unsure where a hotfix JAR should be placed, please get in touch with our support team.

For an overview of how ADD and COPY works, see the documentation.

Once you are satisfied with your Dockerfile, run the following command in the same directory:

docker build -t xl-deploy-custom:9.5.0 .

This command will build and tag a Docker image for you.

Important: Always use semver to version your docker images. Doing so, ensures future compatibility with one of our other tools, xl up.

To run the image locally, use the following command:

docker run -it --rm -p 4516:4516 -e "ADMIN_PASSWORD=desired_admin_password" -e ACCEPT_EULA=Y xl-deploy-custom:9.5.0

If you would like to host the docker image elsewhere, you have two options:

Recommended:

  1. Push this image to a docker registry of your choice. You can either set up your own registry, or use an offering from DockerHub, AWS, GCP and many others. The simplest way of achieving this is to simply run
  2. docker tag xl-deploy-custom:9.5.0 yourdockerhuborg/xl-deploy-custom:9.5.0
  3. docker push yourdockerhuborg/xl-deploy-custom:9.5.0
  4. docker run -it --rm -p 4516:4516 -e "ADMIN_PASSWORD=desired_admin_password" -e ACCEPT_EULA=Y yourdockerhuborg/xl-deploy-custom:9.5.0 on the node you would like to run the container.

Not recommended:

  1. By using docker export and docker load. This is approach is not recommended, as it requires you to move a tar file between different machines.