Closed lorenz closed 9 years ago
@lorenz, thanks for the contribution!
What would you think about explicitly setting the release tag to openjdk-7-jdk
rather than 7
? I spent a few minutes verifying the version [1], it might save someone else time also.
[1] https://github.com/docker-library/official-images/blob/master/library/java#L24
Certainly possible, I just thought that setting java:7 would be more general and allow the guys behind java:7 to choose the best version/type to satisfy the requirement of that image. A comment would maybe help.
Yeah, that's a good point. I think you're good as is and without a comment.
One other issue regarding the size of the image. I haven't verified the numbers, but making this change will add another layer and increase the image size when pulling from Docker Hub.
I am doing a pretty big rewrite of the way the config files are working right now. I hope to somehow squash that new code down before I release it. If the image is much larger, it might make sense to put this change in the new release rather than the current release. Have you looked at the size change after this commit by chance?
The new feature branch that I'm working on is feature/config-refactor
Regarding the image size: The current Dockerfile of java:7 uses the same base (debian:jessie) and also uses apt-get to install java. So the image size should be the same.
The number of layers would also be the same, one RUN instruction in your Dockerfile is basically moved one RUN instruction in the Dockerfile of java:7.
@lorenz it looks like the java:7
image is 604.5 MB
. Am I missing something or is it really that big?
That is really big, but the JDK itself is big and debian is also big. If you want to shrink the image as much as possible, you'd have to go with busybox as base. But that is not nearly as convenient as just using java:7. And your current Image is the same size as the new one with java:7 (because the same commands get executed).
@lorenz do you mind demonstrating how my version 0.8.1
image that is based on debian:jessie
, and your PR, that is based on java:7
, create builds that are the same size?
vagrant@ubuntu-14:/vagrant$ make build
...
vagrant@ubuntu-14:/vagrant$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
pblittle/docker-logstash 0.8.1 90be466f6cd7 2 minutes ago 655.6 MB
debian jessie aaabd2b41e22 12 days ago 154.7 MB
vagrant@ubuntu-14:/vagrant$ make build
...
vagrant@ubuntu-14:/vagrant$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
pblittle/docker-logstash 0.8.1 a5010f8943da 2 minutes ago 923.8 MB
java 7 18c9dbaf9d30 9 days ago 604.5 MB
I hope you're correct. I really would like to use the java:7
base image for all of the reasons that you noted.
My image was indeed larger, it also added the JDK which is not needed. I updated my pull request accordingly. Now the difference is only around 40MiB which seem to come from the version of debian:jessie the images were built with. Yours is 7 weeks old (115MiB) and mine 12 days (154.7MiB).
lorenz@matrix:~/git/docker-logstash$ docker history lorenz/logstash
IMAGE CREATED CREATED BY SIZE
a423aa948619 10 seconds ago /bin/sh -c #(nop) ENTRYPOINT [/app/bin/boot] 0 B
f08c1fafa830 14 seconds ago /bin/sh -c #(nop) EXPOSE map[9292/tcp:{}] 0 B
bbcfe9475e54 18 seconds ago /bin/sh -c #(nop) EXPOSE map[9300/tcp:{}] 0 B
d582e69cd3d9 22 seconds ago /bin/sh -c #(nop) EXPOSE map[9200/tcp:{}] 0 B
7c4224e39c1f 26 seconds ago /bin/sh -c #(nop) ADD dir:9f0e9a8239812799ef2 101 kB
f98f3da16236 31 seconds ago /bin/sh -c mkdir /app 0 B
1f8b4271197f 42 seconds ago /bin/sh -c /opt/logstash/bin/plugin install c 177.6 MB
9122142f9bae About a minute ago /bin/sh -c cd /tmp && wget https://downlo 141.6 MB
b3b572c45037 About a minute ago /bin/sh -c #(nop) MAINTAINER P. Barrett Littl 0 B
b7700942d7a4 10 days ago /bin/sh -c apt-get update && apt-get install 184.2 MB
cd4a89e404ba 12 days ago /bin/sh -c #(nop) ENV JAVA_VERSION=7u71 0 B
aaabd2b41e22 12 days ago /bin/sh -c #(nop) CMD [/bin/bash] 0 B
36fd425d7d8a 12 days ago /bin/sh -c #(nop) ADD file:66c6e568ce73dea052 154.7 MB
511136ea3c5a 17 months ago 0 B
lorenz@matrix:~/git/docker-logstash$ docker history pblittle/docker-logstash
IMAGE CREATED CREATED BY SIZE
40f98a7ec483 7 weeks ago /bin/sh -c #(nop) ENTRYPOINT [/app/bin/boot] 0 B
dca451983e77 7 weeks ago /bin/sh -c #(nop) EXPOSE map[9292/tcp:{}] 0 B
770e8310d234 7 weeks ago /bin/sh -c #(nop) EXPOSE map[9300/tcp:{}] 0 B
043ef4b708ba 7 weeks ago /bin/sh -c #(nop) EXPOSE map[9200/tcp:{}] 0 B
ab8d72b1eff8 7 weeks ago /bin/sh -c #(nop) ADD dir:f653e6a0533e58c4da1 59.17 kB
ae2a720892d6 7 weeks ago /bin/sh -c mkdir /app 0 B
a9e199de87fb 7 weeks ago /bin/sh -c /opt/logstash/bin/plugin install c 177.6 MB
dc83a1a9640f 7 weeks ago /bin/sh -c cd /tmp && wget https://downlo 141.6 MB
3a27089681e8 7 weeks ago /bin/sh -c apt-get update && DEBIAN_FRONT 179.8 MB
5b20d8b8a7ff 7 weeks ago /bin/sh -c #(nop) MAINTAINER P. Barrett Littl 0 B
4971e9d8fee7 7 weeks ago /bin/sh -c #(nop) CMD [/bin/bash] 0 B
571e44c2bdad 7 weeks ago /bin/sh -c #(nop) ADD file:10af23f51d4844362b 115 MB
511136ea3c5a 17 months ago 0 B
@lorenz, thanks for taking the time to work through this. java:7-jre
is exactly what I was looking for. I appreciate your contribution.
@lorenz I pushed the 0.9.0
release out with the new java:7-jre
base image. If you have a minute, do you mind doing a quick test for me? If you are using DockerHub, will you try to pull and build latest
?
docker pull pblittle/docker-logstash
Sorry, I was busy the last few days. I'm going to test your image this afternoon and report back.
I finally managed to test it, everything seems fine.
The official java image basically does the same as yor first RUN command, so if you use that as base, downloads will be faster (because most people already have the java image available locally) and it shortens the dockerfile.