Wednesday, September 20, 2017

Setting up Java + svn + Eclipse+ Tomcat , development environment with docker

Leave a Comment

I just started to tryout docker to see if it helps setting up our development environment , which consists of

  1. Jdk 1.6
  2. Eclipse
  3. RabbitVCS
  4. Tomcat
  5. MySQL server

Our Development desktops are mostly Ubuntu 16.04 . I would have eclipse, RabbitVCS installed on host and the rest in container .

If every thing goes well , developers should be able to download a Docker image . Running that image should give them JDK , Tomcat and MySQL server . Developers can then start using RabbitVCS to check out projects .

Is this feasible with Docker ?

2 Answers

Answers 1

tl;dr

It is not feasible to run eclipse in host OS and use JDK/JRE runs in a container because eclipse has a dependency on JRE. Similarly you cannot have tomcat in one container and JRE/JDK in another container because tomcat needs JRE to run.

Explanation

I would have eclipse, RabbitVCS installed on host and the rest in container....... Running that image should give them JDK , Tomcat and MySQL server

Are you trying to use JDK running on a docker container (and Eclipse IDE running on host os) for active development? If that is the case, it not not feasible (arguable, you can do remote debugging; but remember, debugging is very different than active development) . And it is not the intend of docker. While developing, your developers may need to have JDK installed in their host machine itself. In your case, only sensible thing to run from container is mysql as you don't have any active development there.

Edit: To build a portable development environment

In docker-land, one possible solution is, have eclipse+jdk+tomcat in the same docker image and mount the X11 socket into the container so that you can expose eclipse GUI running in the container to your host OS

More read here: https://blog.jessfraz.com/post/docker-containers-on-the-desktop/

Or just ditch Docker and go to full-blown VM like virtualbox, you might be able to find pre-built images with eclipse in it (not sure), or you can build one after installing all the required packages on a base image and share it amongst your developers.

Answers 2

Yes it's feasible.

I would recommend to use different containers for each service (Mysql/Tomcat/JDK). You could use docker-compose to connect the containers together and automate a lot of tasks. There are plenty of images already on dockerhub that you can use.

Here's an simple example of how you can setup your own docker-compose.yml file:

services:     tomcat_service:     #contains tomcat & jdk         image: tomcat         volumes:             - /local/path:/path/in/docker         links:             - mysql_service         depends_on:             - mysql_service         ports:             - "80:80"           # - other ports for debugging      mysql_service:         image: mysql         volumes:             #you should keep mysql data on the host, not in container             - /local/path/data:/var/lib/mysql 

Each image used above will be downloaded automatically from dockerhub: tomcat, java, mysql

EDIT: jdk and tomcat would be better together in the same container

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment