tjb
02/20/2018, 8:25 PMno main manifest attribute, in /my_app.jar
was the errorrocketraman
02/20/2018, 8:27 PMmy_app.jar
come from? Aren't you running canti.jar
?tjb
02/20/2018, 8:27 PMtjb
02/20/2018, 8:28 PMcanti.jar
rocketraman
02/20/2018, 8:29 PMrocketraman
02/20/2018, 8:29 PMtjb
02/20/2018, 8:30 PMtjb
02/20/2018, 8:31 PMrocketraman
02/20/2018, 8:33 PMdocker run -ti mycontainer /bin/sh
. Since you are using `ENTRYPOINT`and not CMD
you probably need to use --entrypoint
to override it.tjb
02/20/2018, 8:36 PMdocker run -it 87208166d967 /bin/sh --entrypoint
rocketraman
02/20/2018, 8:36 PMdocker run -it 87208166d967 --entrypoint /bin/sh
tjb
02/20/2018, 8:37 PMUnable to find image '87208166d967:latest' locally
but the image is there 87208166d967 canti:1.0.1 "sh -c 'java $JAVA_O…" 6 minutes ago Exited (1) 5 minutes ago cocky_varahamihira
rocketraman
02/20/2018, 8:37 PMrocketraman
02/20/2018, 8:37 PMdocker images
tjb
02/20/2018, 8:38 PMtjb
02/20/2018, 8:38 PMno main manifest attribute, in /canti.jar
rocketraman
02/20/2018, 8:41 PMdocker run -it --entrypoint /bin/sh mycontainer
. It's easier to override CMD
rather than ENTRYPOINT
. I'd switch to CMD
here unless you had a specific reason for using ENTRYPOINT
.rocketraman
02/20/2018, 8:42 PMsh -c
bit.tjb
02/20/2018, 8:43 PMtjb
02/20/2018, 8:43 PMtjb
02/20/2018, 8:43 PMtjb
02/20/2018, 8:44 PMcanti.jar
rocketraman
02/20/2018, 8:44 PMtjb
02/20/2018, 8:44 PMError: Could not find or load main class canti.jar
rocketraman
02/20/2018, 8:45 PMrocketraman
02/20/2018, 8:45 PMtjb
02/20/2018, 8:45 PMtjb
02/20/2018, 8:45 PMjava canti.jar
tjb
02/20/2018, 8:45 PMtjb
02/20/2018, 8:45 PMjava -jar canti.jar
tjb
02/20/2018, 8:45 PMtjb
02/20/2018, 8:46 PMjava canti.jar
gave Error: Could not find or load main class canti.jar
and java -jar canti.jar
gave no main manifest attribute, in canti.jar
rocketraman
02/20/2018, 8:46 PMjava -jar canti.jar
, it works?tjb
02/20/2018, 8:48 PMrocketraman
02/20/2018, 8:48 PMjava -jar ...
.tjb
02/20/2018, 8:48 PMtjb
02/20/2018, 8:48 PMtjb
02/20/2018, 8:49 PMrocketraman
02/20/2018, 8:50 PMWORKDIR /foo
ADD distributions/foo.tar /
CMD ["./bin/foo"]
rocketraman
02/20/2018, 8:51 PMrocketraman
02/20/2018, 8:52 PMmkobit
02/20/2018, 8:53 PMjava -cp canti.jar io.ktor.server.netty.DevelopmentEngine
(or whatever it is) you will also see some class loading/class path issues too
in addition to what @rocketraman already mentioned, about the distribution script, https://github.com/johnrengelman/shadow is another option for "fat jar" type packagingrocketraman
02/20/2018, 9:01 PMrocketraman
02/20/2018, 9:02 PMjava -jar
isn't the best idea either. java -jar
was created to make things simple for end-users, and IMO is not the right way to package and deploy a server-side application.mkobit
02/20/2018, 9:08 PMrocketraman
02/20/2018, 9:09 PMmkobit
02/20/2018, 9:20 PMjlink
in java 9, docker image layering, pods in kubernetes, better distribution mechanisms (like https://docs.gradle.org/current/userguide/java_library_distribution_plugin.html) all offer different approaches with different improves, but i think the "fatj ar" approach is one that is simple and easy to get moving fast with since it is a pattern that has been around for a while. i havent had the opportunity to do much development with java 9 so it might be different there, though
what are your thoughts?tjb
02/20/2018, 9:25 PMtjb
02/20/2018, 9:25 PMtjb
02/20/2018, 9:25 PMjar {
baseName = "canti"
manifest {
attributes 'Main-Class': mainClassName
}
}
tjb
02/20/2018, 9:25 PMrocketraman
02/20/2018, 10:07 PMtjb
02/20/2018, 10:08 PM