Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker setting up

I'm reading lot about Docker these day, I even tried to run it on my laptop with Vagrant. But still I'm not clear why and especially how to introduce it to my team. It's just that I don't see the use cases.

I understand you can create containers for web server and DB. So you can say hey you guys for now on we are using custom-tomcat-1.0 and custom-mysql-1.4 containers I created. So far so clear. The problem I have is with those "data-containers".

I can still somehow understand that I will have DB-data-1.4 with data files for DB container which is updated to current schema, I can have WEB-app-3.5 with my deployables, which will somehow correspond with the DB-data image.

What about java?. If I will have java DB I will need to install JVM on all containers that are using it?

Does it make any sense so far? Now couple of things I don't see their place clearly.

  1. how will developer on local work with it? He will create some WEB-app image snapshot and start it? Or somehow will skip the use of the WEB-app image and will supply somehow the build files directly to the server image?

  2. With jenkins I imagine that it will download the code from git. Build it and create some WEB-app image snapshot. Start everything up. Now I can run some integration test that will use the application from outside somehow, but how?

Basically two question: how are you developing locally with docker, and how are you executing the integration tests. I need real use cases, so I can see the big picture of it. We are using maven, java, spring, sql db, jenkins, junit.

like image 871
Zveratko Avatar asked May 19 '15 06:05

Zveratko


1 Answers

docker forces you to think really hard about what are the immutable and mutable parts of your application. the immutable parts are built as base images while the mutable parts are built as containers (and possibly persisted as images). for instance you may decide to lock down the OS version and Java version for a particular development release cycle. this is the immutable part so you construct the base image of your application based on this. your application code is added to the base image and run as a container.

later, when development and testing is completed, and you are ready to go into production, you may need to retest the application against the latest OS patches and Java updates. At this point, you may start with a new version of the base image and rerun the tests. if the test is successful this becomes the new baseline for your builds.

on similar lines, if your database contains a pre-defined schema and/ or pre-loaded data (immutable) this can be designed as a data-only volume and mounted read-only on the container. any updates made to the database during the application test run, will remain part of the container's file system layer.

like image 80
nagu Avatar answered Oct 16 '22 21:10

nagu