Building custom Docker images
You can use DataStax source code to build a custom Docker image for your environment.
DataStax uses a common base image for all products.
To customize the operating system or install additional packages, modify the base/Dockerfile.
The DataStax base images use OpenJDK due to the end of public updates for Oracle JDK.
All DataStax repositories on Docker Hub include OpenJDK.
Build an image
DataStax provides a code repository on Github for building custom Docker images. To build an image, do the following steps:
-
Clone the DataStax Docker Github repository.
-
Make any desired configuration changes.
-
Run the
./gradlewcommand.
By default, Gradle downloads the DataStax tarballs from the DataStax Downloads page.
To build a product image for a specific version, invoke a Gradle task that follows this pattern:
./gradlew buildPRODUCTVERSIONImage
For example:
./gradlew buildServer6.0.6Image
Build all images
To build all images, run the following command:
./gradlew buildImages
To build more than one image with specific versions, specify each build with the desired product and version.
For example:
./gradlew buildServer6.0.6Image buildOpscenter6.5.0Image
To get the list of all available tasks, run:
./gradlew tasks
Build multiple product versions
To support multiple product versions without duplicating files, Docker build contexts are generated from source folders that contain FreeMarker templates (files with .ftl extensions).
The following conventions are used:
-
Docker build contexts are generated from self-describing product folders. For example,
server,opscenter, andstudio. -
All files without the
.ftlextension are copied to the build context. -
Files with
.ftlextensions are processed as FreeMarker templates:-
Template directives are written using angle bracket syntax.
-
Square bracket syntax is used for interpolations.
-
The processed files are copied to the build context without
.ftlextension. For example,Dockerfile.ftlis copied asDockerfile.
-
-
FreeMarker templates use the
versionvariable:-
version.majorreturns product version major number -
version.minorreturns product version minor number -
version.bugfixreturns product version bugfix number -
The following version functions are available:
-
version.lowerThan('x.y.z')returnstrueifversionis semantically lower thanx.y.z -
version.greaterEqualThan('x.y.z')returnstrueifversionis semantically greater than or equal tox.y.z.
-
-
To customize the products or to use multiple product versions, modify the templates in their corresponding product folder.