News for hackers. Stuff that matters.
Re:Running Java on Docker images on a Mac by gameface on Monday May 15, 2017 @03:31AM (#14339832)
What are the reasons for wanting to run java inside docker? The jvm is supported andavailable, and portable on every environment socket is, so what does it get you?
Re:Running Java on Docker images on a Mac by cel1ne on Monday May 15, 2017 @05:59AM (#14340368)
Also many common problems like targeting the correct Jdk, customize start parameters and classpath, shipping agents, selecting native libraries etc. are nowadays better solved by using capsule for packaging.

It gets you a single jar without classloader interference or onejar-zipping madness

It even supports automatic download of dependencies like the clojure runtime and sharing those between apps.

http://www.capsule.io

Re:Running Java on Docker images on a Mac by coldtea on Monday May 15, 2017 @04:10AM (#14339953)
Developing/testing for multiple versions at the same time, having repeatable tests, versioning, using the same environment for development as your final deliverable (e.g. a Linux environment not OS X), being able to take your container and run it on production as is, and more things besides?
Re:Running Java on Docker images on a Mac by manquer on Monday May 15, 2017 @04:22AM (#14339995)
wouldn't a build server be better for that sort of release testing? like travis CI / gitlab CI runner on DO / light sail etc @ $5/month
Re:Running Java on Docker images on a Mac by coldtea on Monday May 15, 2017 @04:54AM (#14340124)
Not all developers have access to a build server or want to bother setting up one.
Re:Running Java on Docker images on a Mac by barrkel on Monday May 15, 2017 @09:50AM (#14341541)
Yes; you use the build server to build the docker image, and run tests on the docker image in a test environment.
Re:Running Java on Docker images on a Mac by agibsonccc on Monday May 15, 2017 @07:33AM (#14340771)
A significant amount of java apps (think finance/high frequency trading) run a ton of java native interface.

A ton of microservices are built with the JVM. Turns out containers are pretty good at that as well.

Re:Running Java on Docker images on a Mac by bschwindHN on Monday May 15, 2017 @09:28AM (#14341362)
I feel like I just read a bunch of "facts" that don't answer the question and have no real reasoning behind them.
Re:Running Java on Docker images on a Mac by agibsonccc on Monday May 15, 2017 @11:29AM (#14342317)
To clarify a bit - "platform dependent/hard to run code" exists in java land. Docker is good at managing native dependncies.

I'm also assuming folks reading this have had some context around microservices and k8s. Microservices no matter what language are well suited to containers and container orchestration. It's a widely used pattern to have self contained services in containers with some sort of orchestration managing the containers those services are deployed in.

Those "facts" were targeting an audience that have at least some familiarity with containers and the basics of the problems they solve but maybe less familiarity with the JVM (which from my experience is the typical reader on HN).

Re:Running Java on Docker images on a Mac by tyingq on Monday May 15, 2017 @09:22AM (#14341314)
One I've seen is less technical, and more organizational. Once it's in docker, the development team now owns things like the jvm version, command line parameters (thread pool settings, gc settings, etc). Lacking that, in some large companies, some other team has control of your environment. Silly, yes, but that is one of the bigger motivators I've seen for docker use at big companies...clawing back control.
Re:Running Java on Docker images on a Mac by falcolas on Monday May 15, 2017 @10:48AM (#14341968)
This is both good and bad. Good for developers who can control more, bad for sysadmins who have to force JVM updates to address security vulnerabilities and inefficient settings (hello world pre-allocating 10 gigs of memory).
Re:Running Java on Docker images on a Mac by gutnor on Monday May 15, 2017 @11:26AM (#14342297)
Most likely, organisation that needs this kind of workaround do not have sysadmin that monitor or track JVM updates. They just have inflexible process guardian with a 2 week lead time and at least 1 man-week worth of effort on a specific budget code. Of course the only source of change request would be the developers themselves.

I have seen organisation devolve like that on the database side. At one time you have a DBA team monitoring server, planning for capacity, upgrade, optimising script and owning datamodel. A few years of cost cutting and 3 guys own the datamodel of tens of application, over hundreds of servers, basically becoming a huge bottleneck for the 300+ developers. When adding a column is eating half of your project budgets and adding uncertainty on delivery date, developers become creative. The best of them sneak a way to get DBA access, the others multiplex value in existing columns (Hello, "PROPERTIES" xml column !)

Re:Running Java on Docker images on a Mac by tyingq on Monday May 15, 2017 @11:12AM (#14342169)
It'll come full circle soon enough. Some PHB will centralize the developers that deal with docker, and we'll start over.

In the early days of Unix, there weren't sysadmins really...just one or two devs on each team that dealt with it. They were later centralized, and...seen this cycle before.

Re:Running Java on Docker images on a Mac by vkjv on Monday May 15, 2017 @09:19AM (#14341295)
My primary reason is orchestration. By putting it inside Docker it runs like every other application in our Kubernetes cluster.

If everything you run is Java, it might not make sense, but in a polyglot, the uniformity can be really beneficial.

Re:Running Java on Docker images on a Mac by codeN on Monday May 15, 2017 @03:44AM (#14339872)
I have faced issues relating to requiring specific versions of JDK for each software. I don't work with Java so using a docker would have been a simpler solution, sadly this was before dockers became mainstream.
Re:Running Java on Docker images on a Mac by stevehiehn on Monday May 15, 2017 @07:59AM (#14340875)
In the common and unfortunate situation where devops does not allow app developer access to prod environments containers are a dream. If the prod env is running docker your container is almost certain to work.
Re:Running Java on Docker images on a Mac by coredog64 on Monday May 15, 2017 @10:25AM (#14341793)
SOX 404 mandates segregation of duties. You literally cannot access prod if you also have access to dev.

Granted, this is only for US public companies, and only for systems that are in scope for your 404 audits.

Re:Running Java on Docker images on a Mac by dkersten on Monday May 15, 2017 @05:07AM (#14340175)
We run java + clojure in Docker and we do it so that we can connect all of the dependencies together with Docker-compose. We don't "develop" inside docker, but we do integration tests in docker. We also deploy (CI and prod) on docker for convenience.

This setup also allows us test resiliency under bad network conditions using https://github.com/IG-Group/Havoc/

Re:Running Java on Docker images on a Mac by rockostrich on Monday May 15, 2017 @10:34AM (#14341873)
This is how I like to use Docker. Especially if it's a project that I'm working on every day. Docker-compose makes running a single app and all of its dependencies locally really simple.

The other use case for Docker, for me at least, is running specific versions of libraries. The other day we had a problem with npm and it was working for everyone locally. Turns out we were a few versions behind and it was much simpler to do `docker run -it node:0.12 bash` than to install the node version manager alongside my homebrew install of node.

Re:Running Java on Docker images on a Mac by dagw on Monday May 15, 2017 @03:47AM (#14339883)
Running multiple specific version of the JDK is kind of a pain. So if you are working on projects targeting specific versions of the JDK then isolating each on in its own container isn't the dumbest thing to do.
Re:Running Java on Docker images on a Mac by currywurst on Monday May 15, 2017 @04:02AM (#14339930)
But initializing the JAVA_HOME and related env variables before launching your java process should help, right?
Re:Running Java on Docker images on a Mac by madeofpalk on Monday May 15, 2017 @04:39AM (#14340059)
Or, just use Docker to capture all of that :)
Re:Running Java on Docker images on a Mac by twelve40 on Monday May 15, 2017 @03:35AM (#14339844)
if, say, zookeeper was a dependency for local development and you didn't want to go through the installation on every laptop... i guess?
Re:Running Java on Docker images on a Mac by jvwilge on Monday May 15, 2017 @03:41AM (#14339860)
That's right and another possibility is to create a small cluster to do integration testing (on Jenkins for example). It's more easy to share containers with colleagues so you don't have to worry about about dependencies. It's also easier to limit cpu/memory in a container to check the cpu/memory requirements of your application.