Closed Basma1912 closed 3 years ago
If you mean the KafkaProperties file, this will need to be mounted into docker volume and then you can run it using -f
flag
I copied kafkaproperties file inside the docker image , but still when i run it , it says (No such file or directory)
Something like this should do the trick:
docker run -v /Users/omaral-safi/Code/consumer-monitoring.properties:/work/consumer-monitoring.properties -p 9739:9739 --rm omarsmak/kafka-consumer-lag-monitoring:latest -b kafka1:9092,kafka2:9092,kafka3:909 -c "my_awesome_consumer_group_01" -m "prometheus" -i 5000 -p 9739 -f /work/consumer-monitoring.properties
Whereby /Users/omaral-safi/Code/consumer-monitoring.properties
is the file in your local machine and /work/consumer-monitoring.properties
is the target file in the container and then you supply -f
flag with /work/consumer-monitoring.properties
because now is mounted into the container
Hello @Basma1912 , did you manage to solve your issue?
I did for some reason it didn't like the "-f config.properties" together , so the working Dockerfile looks like below:
# Use the official image as a parent image.
FROM amd64/openjdk:16
# Set the working directory.
WORKDIR /
# Copy the file from your host to your current location.
COPY ./config.properties /config.properties
COPY ./kafka-consumer-lag-monitoring.jar /kafka-consumer-lag-monitoring.jar
# Add metadata to the image to describe which port the container is listening on at runtime.
EXPOSE 9739
# Run the specified command within the container.
CMD ["java", "-jar", "/kafka-consumer-lag-monitoring.jar", "-b" ,"kafkaserver:9092","--consumer.groups", "xxxxxx", "-f", "config.properties", "-m", "prometheus"]
I see, anyway I am working on major version 0.1.0 which includes the support for configuration via environment variables, hence you don't need to build an image for it, just from docker run
directly, e.g:
docker run --rm -e MONiTORING_LAG_prometheus_HTTP_PORT=8080 -p 8080:8080 -e monitoring_lag_logging_rootLogger_appenderRef_stdout_ref=LogToConsole -e monitoring_lag_consumer_groups="test-*" -e kafka_bootstrap_servers=host.docker.internal:9092 2050e45c68bc
I am trying to use the docker image with the -f flag and it keeps saying no (No such file or directory)