Adarsh Sanjeev d40cf148da
Add check to see if druid is running in kubernetes (#17697)
The PR #16386 changed the docker file to use the canonical hostname instead of ip by default. This was an attempt to fix druid.indexer.task.restoreTasksOnRestart , as it does not work on kubernetes without the canonical hostname.

This change is not backward compatible, as switching to canonical names would not work with docker. This PR attempts to fix this by adding a check to see if the deployment is in a kubernetes environment by checking ${KUBERNETES_SERVICE_HOST} and using canonical hostnames instead of IP addresses only in that case.
2025-02-14 14:06:40 +05:30
..
2024-12-19 09:08:20 +05:30

Build

From the root of the repo, run following command:

DOCKER_BUILDKIT=1 docker build -t apache/druid:tag -f distribution/docker/Dockerfile .

Building images on Apple M1/M2

To build images on Apple M1/M2, you need to follow the instructions in this section.

  1. build Druid distribution from the root of the repo
    mvn clean package -DskipTests -Pdist
    
  2. build target image
    DOCKER_BUILDKIT=1 docker build -t apache/druid:tag -f distribution/docker/Dockerfile --build-arg BUILD_FROM_SOURCE=false .
    

Run

  1. Edit distribution/docker/docker-compose.yml file to change the tag of Druid's images to the tag that's used in the 'Build' phase above.
  2. Edit environment file to suite if necessary.
  3. Run:
    docker compose -f distribution/docker/docker-compose.yml up
    

MySQL Database Connector

This image contains solely the postgres metadata storage connector. If you need the mysql metadata storage connector, you can use Dockerfile.mysql to add it to the base image above.

docker build -t apache/druid:tag-mysql --build-arg DRUID_RELEASE=apache/druid:tag -f distribution/docker/Dockerfile.mysql .

where druid:tag is the version of Druid image to use as the base.