Comments (14)
My mistake, sorry. You found the right openjdk image.
from openjdk-runtime.
JAVA_OPTS
is set in setup-env.bash, which is only invoked in the docker-entrypoint.bash
if the run command starts with java
or some other argument that is not an executable. What does your docker run command look like?
from openjdk-runtime.
For playframework, we run the bash script generated by sbt dist
. The script eventually runs java
with a lot of arguments, and, fortunately, the script uses the JAVA_OPTS env.
Here's the script template: https://github.com/sbt/sbt-native-packager/blob/master/src/main/resources/com/typesafe/sbt/packager/archetypes/scripts/bash-template#L297
Here's my docker run command:
CMD ["bin/myappname", "-Dlogger.file=conf/prod.xml", "-Dconfig.file=conf/prod.conf", "-Dplay.crypto.secret=fakesecret", "-Dhttp.port=8080"]
I make my own docker-entrypoint.bash, and this is how it looks like:
#!/bin/bash
source /setup-env.bash \
&& exec env JAVA_OPTS="$JAVA_OPTS" "$@" 2>&1
from openjdk-runtime.
If there is a way to start the app directly via the java
executable, then you wouldn't need the custom CMD or the modified docker-entrypoint.bash
. I would recommend looking into that option.
I'm not sure about modifying the actual runtime image the way you suggested to accommodate the Scala Playframework usecase. If the usecase was more generic, it would make more sense, but otherwise, extending the runtime image with a custom Dockerfile seems to be the most appropriate solution.
from openjdk-runtime.
@tanin47 On a second thought, if we simply added export JAVA_OPTS
line before the exec "$@"
in docker-entrypoint.bash
, would it solve your issue?
from openjdk-runtime.
If there is a way to start the app directly via the java executable, then you wouldn't need the custom CMD or the modified docker-entrypoint.bash. I would recommend looking into that option.
@tanin47 On a second thought, if we simply added export JAVA_OPTS line before the exec "$@" in docker-entrypoint.bash, would it solve your issue?
This would be helpful. I'll be able to get rid of my docker-entrypoint.bash completely. (One fewer file to maintain)
But I need to verify first whether export
works as expected. There is some weird issue with export
inside a bash script. I'll try and report back.
Thank you!
from openjdk-runtime.
@tanin47 The docker-entrypoint has been written as it is so that follows the docker standard practises that easily allow other args and/or commands to be run in the image. I think that it is worth the effort to use the standard docker-entrypoint, potentially with modifications to fit your requirements.
from openjdk-runtime.
I confirm that adding export JAVA_OPTS="$JAVA_OPTS"
in docker-entrypoint.bash works as well.
I also notice that setup-env.bash is only invoked if the first argument is neither executable or java
. Our first argument is executable. This would need to be fixed.
Is there a downside for running setup-env.bash and setting $JAVA_OPTS
every time? The users (who use this JDK image) would expect JAVA_OPTS to be set properly regardless how their commands look like.
from openjdk-runtime.
I don't see any problem running setup-env.bash all of the time. I also think the script should export all the variables it sets. I'll prepare a PR...
from openjdk-runtime.
Thank you! This change is super helpful. Please let me know when the image is deployed. I'll test it promptly.
from openjdk-runtime.
Is this deployed yet?
from openjdk-runtime.
Yes, and it will be made :latest
soon.
For now, try using this image: gcr.io/google-appengine/jetty:9.4-2017-01-26_21_46
from openjdk-runtime.
Hmm.. I can't make the jetty image work. Do you have the openjdk version?
from openjdk-runtime.
I tested against gcr.io/google-appengine/openjdk:8-2017-01-26_21_19
It seems to work. I only need CMD command and can remove my own docker-entrypoint.bash
. Thank you for making this change.
from openjdk-runtime.
Related Issues (20)
- replace uuidgen with more standard tools for deployment token
- Do not build a "builder" image during every image build.
- Local simulation of cloud build fails
- Install OpenJDK 9 from the stretch-backports repository
- Remove `DBG_ENABLE` from README.md HOT 2
- Cloud Debugger doesn't work w/ OpenJDK 9 HOT 11
- Update structure tests to use "Metadata Test" features
- Refactor structure tests to use intermediate container for test scripts
- OpenJDK 10 Runtime HOT 2
- Run OpenJDK Build through Java JCK/TCK HOT 1
- OpenJDK Version Behind for Java 8 HOT 1
- Cannot invoke wget due to libgnutls missing
- Request for supporting Java 10 RunTime HOT 6
- OpenJ9 Runtimes HOT 1
- Graal Runtimes
- TYPO in the readme
- Differences Between Google openjdk Images?
- Profiler Agent Bug HOT 1
- openjdk11 not working HOT 5
- Sample Dockerfile does not work with App Engine - flexible environment
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openjdk-runtime.