Szabolcs Stremler created KAFKA-20448:
-----------------------------------------

             Summary: Docker image build fails with --image-type=jvm and 
--kafka-archive
                 Key: KAFKA-20448
                 URL: https://issues.apache.org/jira/browse/KAFKA-20448
             Project: Kafka
          Issue Type: Bug
          Components: docker
    Affects Versions: 4.2.0
            Reporter: Szabolcs Stremler


The Docker image build fails if `docker_build_test.py` is called with 
--image-type=jvm --kafka-archive=path/kafka_2.13-4.4.0-SNAPSHOT.tgz

Reproduction:

```

./gradlew clean jar
./gradlew releaseTarGz
cd ..
mkdir kafka-docker
cd kafka-docker
python3 -m venv kafka
source kafka/bin/activate
python3 -m pip install -r ../kafka/docker/requirements.txt
python3 ../kafka/docker/docker_build_test.py kafka/test 
--image-tag=4.4.0-SNAPSHOT --image-type=jvm 
--kafka-archive=../kafka/core/build/distributions/kafka_2.13-4.4.0-SNAPSHOT.tgz 
--build

```

The image build has two issues:

1. `docker/jvm/Dockerfile` sets `set -eux` before it calls `if [ -n 
"$kafka_url" ]; then \` and `$kafka_url` is not set, because we use 
`--kafka-archive` instead and this makes the shell exit with an error 
immediately, so the other branch is not executed where the script would start 
using the kafka archive.

2. If the issue above is fixed, the Docker image build still fails during the 
JSA file creation. `docker/jvm/jsa_launch` starts the broker, but 
`opt/kafka/bin/kafka-server-stop.sh` doesn't stop the broker, so the JSA file 
is not created. `opt/kafka/bin/kafka-server-stop.sh` is not able to stop the 
broker, because it is not able to find the PID of the Java process. The Java 
process is started with all the jars in the command and the end of the command 
is truncated by `ps`. We could add `-x -x` to the `ps` command, but the script 
uses a simplified version of `ps` from Busybox, so it doesn't have the `- -- x` 
argument.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to