Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more verbosity to command execution when building docker image #486

Closed
dmak opened this issue Apr 16, 2019 · 5 comments
Closed

Add more verbosity to command execution when building docker image #486

dmak opened this issue Apr 16, 2019 · 5 comments

Comments

@dmak
Copy link

dmak commented Apr 16, 2019

It would be nice if step-by-step command execution is logged to console when complex shell scenarios are executed. Consider the following case:

$ docker-compose -f docker-compose-single-broker.yml up
...
 ---> Running in 5ce05e594e30
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/19) Installing pkgconf (1.3.10-r0)
...
(19/19) Installing jq (1.5-r5)
Executing busybox-1.27.2-r7.trigger
OK: 232 MiB in 69 packages
wget: server returned error: HTTP/1.1 404 Not Found
ERROR: Service 'kafka' failed to build

From above log it is not clear what went wrong.
After adding / changing:

  • In Dockerfile:
RUN set -x && apk add --no-cache
  • In download-kafka.sh:
#!/bin/sh -e

set -x

the output is the following:

 ---> Running in 5fe2c27941ec
+ apk add --no-cache bash curl jq docker
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/19) Installing pkgconf (1.3.10-r0)
...
(19/19) Installing jq (1.5-r5)
Executing busybox-1.27.2-r7.trigger
OK: 232 MiB in 69 packages
+ mkdir /opt
+ chmod a+x /tmp/broker-list.sh /tmp/create-topics.sh /tmp/download-kafka.sh /tmp/start-kafka.sh
+ mv /tmp/start-kafka.sh /tmp/broker-list.sh /tmp/create-topics.sh /usr/bin
+ sync
+ /tmp/download-kafka.sh
+ curl --stderr /dev/null https://www.apache.org/dyn/closer.cgi?as_json=1
+ jq -r .preferred
+ mirror=http://apache.mirror1.spango.com/
+ [[ -z http://apache.mirror1.spango.com/ ]]
+ url=http://apache.mirror1.spango.com/kafka/1.1.0/kafka_2.12-1.1.0.tgz
+ wget -q http://apache.mirror1.spango.com/kafka/1.1.0/kafka_2.12-1.1.0.tgz -O /tmp/kafka_2.12-1.1.0.tgz
wget: server returned error: HTTP/1.1 404 Not Found
ERROR: Service 'kafka' failed to build

Now it is clear what needs to be corrected.

Suggestion

set -x is added/used in shell scripts which could potentially break.

@sscaling
Copy link
Collaborator

Are you using recent code? This commit should have addressed the mirror issue.

@dmak
Copy link
Author

dmak commented Apr 16, 2019

Well, the report is not about the issue with Kafka version, but the possibility to identify & correct the issue. It's not so difficult to correct the version once one knows what is going on. Thanks for fixing it anyway, but this very issue is about the different matter.

@sscaling
Copy link
Collaborator

I'm just trying to highlight that the specific issue you are seeing should be fixed in master.

I'm assuming anyone digging this deep would know how to debug the issue. We haven't really had issues with the build process other than the mirror not hosting the version it is supposed to host. So it's just a question of whether or not everyone's build logs get cluttered to support an exceptionally small use-case or not. Even in your proxy issue use-case (as referenced in the other #487 issue), this would not help just copy&paste debug because of the wget -q command omits the resolved server IP in the logs. All I could infer is that you can't reach the mirror, and then you'd need to perform some additional debug commands anyway. So it's just a question of how much value does it add.

@dmak
Copy link
Author

dmak commented Apr 16, 2019

I agree that if in 99% cases docker build works smoothly, extra output will only create noise. Feel tree to close an issue – somebody can find it via search, if necessary.

@sscaling
Copy link
Collaborator

Thanks for closing the loop and confirming assumptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants