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

Change parent image to openjdk #8

Merged
merged 2 commits into from
Jun 21, 2018
Merged

Conversation

alicefr
Copy link
Contributor

@alicefr alicefr commented May 25, 2018

The official openjdk image is based on alpine, it is smaller than
the openjdk built by cantara.
Additionally, it supports multi-arch image and it allows to build the zipkin
docker images for other architectures.

Signed-off-by: Alice Frosi [email protected]

The official openjdk image is based on alpine, it is smaller than
the openjdk built by cantara.
Additionally, it supports multi-arch image and it allows to build the zipkin
docker images for other architectures.

Signed-off-by: Alice Frosi <[email protected]>
@alicefr
Copy link
Contributor Author

alicefr commented May 25, 2018

On my system I built the docker image with and without the changes of the PR.
I squashed the two images by using the flag --squash offered by docker build
Docker version:

$ Client:
 Version:      18.03.1-ce
 API version:  1.37
 Go version:   go1.9.5
 Git commit:   9ee9f40
 Built:        Thu Apr 26 07:17:38 2018
 OS/Arch:      linux/amd64
 Experimental: true
 Orchestrator: swarm

Server:
 Engine:
  Version:      18.03.1-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.5
  Git commit:   9ee9f40
  Built:        Thu Apr 26 07:15:45 2018
  OS/Arch:      linux/amd64
  Experimental: true

Build without changes:

$ docker build --squash -t openzipkin/jre-full:cantara .
Sending build context to Docker daemon  73.22kB
Step 1/6 : FROM cantara/alpine-zulu-jdk8
 ---> 82d6c0ad442e
Step 2/6 : MAINTAINER OpenZipkin "http://zipkin.io/"
 ---> Running in c514903bbc14
Removing intermediate container c514903bbc14
 ---> a1eda0f55143
Step 3/6 : RUN rm -rf /usr/local/java/bin /usr/local/java/lib /usr/local/java/include
 ---> Running in 7b27d46a1d3f
Removing intermediate container 7b27d46a1d3f
 ---> cd30716f3ae2
Step 4/6 : RUN ln -s /usr/local/java/jre/bin /usr/local/java/bin
 ---> Running in 72d19f1647ab
Removing intermediate container 72d19f1647ab
 ---> 47cf9b925539
Step 5/6 : RUN apk add --update --no-cache curl
 ---> Running in bfdac346a7bf
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
OK: 13 MiB in 18 packages
Removing intermediate container bfdac346a7bf
 ---> 4e133f552e16
Step 6/6 : RUN echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf
 ---> Running in c1ea17375329
Removing intermediate container c1ea17375329
 ---> f91fbcfe11a4
Successfully built be1ccc01d201
Successfully tagged openzipkin/jre-full:cantara

Build with changes:

$ docker build --squash -t openzipkin/jre-full:openjdk .
Sending build context to Docker daemon  73.22kB
Step 1/5 : FROM openjdk:8-jdk-alpine
 ---> 224765a6bdbe
Step 2/5 : MAINTAINER OpenZipkin "http://zipkin.io/"
 ---> Running in dd4da5ceb0a2
Removing intermediate container dd4da5ceb0a2
 ---> 137a92510897
Step 3/5 : RUN rm -rf /usr/local/java/bin /usr/local/java/lib /usr/local/java/include
 ---> Running in d790d2afc889
Removing intermediate container d790d2afc889
 ---> 45f3161ac2ca
Step 4/5 : RUN apk add --update --no-cache curl
 ---> Running in 8dbc5d81d01e
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
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
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/3) Installing libssh2 (1.8.0-r2)
(2/3) Installing libcurl (7.60.0-r0)
(3/3) Installing curl (7.60.0-r0)
Executing busybox-1.27.2-r7.trigger
OK: 100 MiB in 54 packages
Removing intermediate container 8dbc5d81d01e
 ---> d6ab589f720c
Step 5/5 : RUN echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf
 ---> Running in 6123bff8d838
Removing intermediate container 6123bff8d838
 ---> 16daa380cbbc
Successfully built 0985e011e4fc
Successfully tagged openzipkin/jre-full:openjdk

Size:

$ docker images | grep openzipkin
openzipkin/jre-full                          openjdk                                    0985e011e4fc        9 minutes ago       104MB
openzipkin/jre-full                          cantara                                    be1ccc01d201        10 minutes ago      164MB

The PR solves the issue #7

@codefromthecrypt
Copy link
Member

Thanks for putting in the elbow grease! The only things on this PR besides verifying manually that the zipkin image still builds and runs :P... is likely a README update. We formerly had a heuristic to know which patch release something was.

Copy link
Member

@shakuzen shakuzen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay for smaller Docker images. Thank you for this. Just one comment on a comment.

Dockerfile Outdated
@@ -1,11 +1,9 @@
FROM cantara/alpine-zulu-jdk8
FROM openjdk:8-jdk-alpine
MAINTAINER OpenZipkin "http://zipkin.io/"

# Remove 40M worth of SDK things, but link back /usr/local/java/bin to help tools
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading things correctly, it looks like this comment needs to be updated as this Dockerfile no longer does the part "link back /usr/local/java/bin to help tools that auto-detect JAVA_HOME." Is that not needed anymore because of a difference in the openjdk image?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if I build with the symbolic link it cannot find /usr/local/java/bin:

docker build -t docker-jre:openjdk .
Sending build context to Docker daemon  25.75MB
Step 1/6 : FROM openjdk:8-jdk-alpine
 ---> e0f8c4b438bc
Step 2/6 : MAINTAINER OpenZipkin "http://zipkin.io/"
 ---> Running in 77edaa4e1e78
Removing intermediate container 77edaa4e1e78
 ---> b3804f3bdcb9
Step 3/6 : RUN rm -rf /usr/local/java/bin /usr/local/java/lib /usr/local/java/include
 ---> Running in 69dc7af5363a
Removing intermediate container 69dc7af5363a
 ---> 28ff40e469e9
Step 4/6 : RUN apk add --update --no-cache curl
 ---> Running in 1ceca5159f3c
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/s390x/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/s390x/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/s390x/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/s390x/APKINDEX.tar.gz
(1/3) Installing libssh2 (1.8.0-r2)
(2/3) Installing libcurl (7.60.0-r1)
(3/3) Installing curl (7.60.0-r1)
Executing busybox-1.27.2-r6.trigger
OK: 99 MiB in 54 packages
Removing intermediate container 1ceca5159f3c
 ---> 01a9670d7b1b
Step 5/6 : RUN ln -s /usr/local/java/jre/bin /usr/local/java/bin
 ---> Running in 58aa2493ae4d
ln: /usr/local/java/bin: No such file or directory
The command '/bin/sh -c ln -s /usr/local/java/jre/bin /usr/local/java/bin' returned a non-zero code: 1

About the docker-squash command, it is now possible to build a squashed image by directly using docker build --squash with the experimental flag set.

@codefromthecrypt
Copy link
Member

ps we are just waiting for this to be a higher patch level than what we have now.

@codefromthecrypt
Copy link
Member

also we can consider JRE 9 I think. zipkin has no JRE 8 constraints afaik (cc @shakuzen)

@codefromthecrypt
Copy link
Member

whoot! we have a higher patch

@codefromthecrypt codefromthecrypt merged commit 8cd5043 into openzipkin:master Jun 21, 2018
@codefromthecrypt
Copy link
Member

thanks @alicefr @zeagord @shakuzen

@codefromthecrypt
Copy link
Member

I've recut the zipkin images which are now on this JRE. Thanks!

@codefromthecrypt
Copy link
Member

hey @alicefr looks like this image has stopped getting patches, and there's no clear signal a 11 version will come either. any ideas?

@alicefr
Copy link
Contributor Author

alicefr commented Dec 3, 2018

hi @adriancole. I google a little and found this issue docker-library/openjdk#211 . As they point in the issue, there is an alternative openjdk image https://hub.docker.com/r/adoptopenjdk/openjdk11/tags/ with the tag alpine. However, there is only the full jdk and the images is bigger than the images you're using now. I tried to build the zipkin image by using adoptopenjdk/openjdk11:alpine-slim and I got

build-adoptopenjdk-slim-11   latest                      307079e3be8b        34 minutes ago      252MB

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Dec 3, 2018 via email

@alicefr
Copy link
Contributor Author

alicefr commented Dec 3, 2018

yes, unfortunately there isn't much that we can do, if the openjdk-jre 11 is not released for alpine. See https://bugs.alpinelinux.org/issues/8089

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

Successfully merging this pull request may close these issues.

4 participants