Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setup Java development environment with Docker

The last couple of days I spend a lot of time digging into docker. I'm really impressed about the possibility to have a environment within development that could be the same as in production!

At the moment I want to start small and begin to enhance the development process. We are developing Java Applications which are deployed on tomcat. The developers are using IDEs like Eclipse and IntelliJ.

During development you configure your tomcat environment within the IDE so you can automatically deploy and debug your code. Therefore the tomcat base directory has to be available to setup.

Currently I have a docker debian image with tomcat installed on /opt/tomcat.

I was now hoping to be able to link the contents of the containers /opt/tomcat directory to an directory within my host. Sadly that feature doesn't seem to exist. With the -v option you can only mount a host directory within the container and not the other way around.

Currently the only solution I see would be mounting the webapps directory of the container and drop my war file in here, which is in my point of view pretty unproductive.

You have to start/restart your tomcat manually, only remote debugging is possible, you don't have your logs within your IDE console.

So, does anyone has any idea on optimise the development workflow of Java Webapp development using docker?

like image 457
daniel Avatar asked Jan 07 '15 07:01

daniel


Video Answer


2 Answers

I saw a blog which was talking about doclipser (Eclipse + Docker).

Within the blog, primarily at the bottom of the post, it mentioned the following tools:

  • doclipser
  • Exlipse Docker Tooling (EDT)
  • domeide.github.io
  • Sublime Docker
  • IntelliJ IDEA 14.1
  • Eclipse JBoss Tools
  • Visual Studio 2015 RC Tools for Docker - As of 9/17/2015, this plugin hasn't been released yet. But you should be able to preview extension.

Hope this helps :)

like image 184
Randy B. Avatar answered Sep 23 '22 22:09

Randy B.


You might have to run Eclipse and Tomcat in the same container, however I'd definitely try to get them to run in two separate containers first. Maybe start with this base image and try to link it to a Tomcat image using a shared volume.

like image 36
Abdullah Jibaly Avatar answered Sep 21 '22 22:09

Abdullah Jibaly