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

Dockerfile issues #3

Closed
etki opened this issue Feb 26, 2017 · 4 comments
Closed

Dockerfile issues #3

etki opened this issue Feb 26, 2017 · 4 comments
Assignees

Comments

@etki
Copy link

etki commented Feb 26, 2017

Hi! I was browsing web and somehow ended in your dockerfile. I have a feeling that:

  • There is no sense to declare /tmp as volume
  • touch /app.jar modifies whole jar file and creates new docker layer with weight of app.jar (that's 50-100mb for each component, ouch)
  • Java launch options in entrypoint is certainly not something end user will expect, it's much better to wrap everything in entrypoint script:
#!/bin/bash
JAVA_MEMORY_OPTS="${JAVA_MEMORY_OPTS:=-Xmx256m}"
JAVA_MANDATORY_OPTS="-Djava.security.egd=file:/dev/./urandom"
...
JAVA_OPTS="$JAVA_MEMORY_OPTS $JAVA_MANDATORY_OPTS ... $JAVA_EXTRA_OPTS"
exec java $JAVA_OPTS -jar /app.jar
# or even don't squash all of them into one variable
  • It's better to avoid Oracle JDK due to end-user licensing issues and use OpenJDK instead (public library images are already there)
  • From what i've seen in docker-compose output, nearly every dockerfile contains same issues

I guess it would be better to deal with those, and, probably just create single base image - i personally think of it as an antipattern, but with ONBUILD you can easily reduce service dockerfiles to two or three lines.

@avarabyeu
Copy link
Member

hi @etki
Regarding java memory settings - totally valid. It's fixed in 2.7.2 release of API service and planned to be fixed everywhere in release 3.0. At the same time, i do not really see any reason to move that logic in separate script.
OracleJDK is also good point, switching to OpenJDK is also in roadmap and planned for 3.1 release.

Regarding other points you can find a bit more details here:
https://spring.io/guides/gs/spring-boot-docker/
Guide has very good explanation regarding touch and TMP volume. BTW, tmp dir is used when API service receive multipart requests (they are being cached on disk before processing)

@avarabyeu avarabyeu self-assigned this Feb 27, 2017
@etki
Copy link
Author

etki commented Feb 27, 2017

@avarabyeu

  • I believe there is no need for modification time of the jar file; also, it can be done in the single step by curl <url> -o /app.jar && touch /app.jar or similar wget action.
  • I still see no sense in /tmp volume, /tmp dir is always present in every distro. In fact, volume creates persistent directory on end user machine, polluting it more and more with every launch without gaining any benefit rather than swapping COW filesystem for host fs. I've left a little more detailed issue on mysql image (Why is there volume for data in the first place? docker-library/mysql#255), but i really don't see anything good it may do.

@avarabyeu
Copy link
Member

avarabyeu commented Mar 14, 2017

@etki Agreed on wget. Scheduled for 3.1 release. See reportportal/reportportal#84

@manikarnam
Copy link

Thank you

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

No branches or pull requests

3 participants