RestComm / Restcomm-Docker

Docker Image for RestComm at https://github.com/RestComm/RestComm-Connect
http://www.restcomm.com/
GNU Affero General Public License v3.0
14 stars 31 forks source link

Docker file container size optimization. #22

Open leftyb opened 8 years ago

leftyb commented 8 years ago

We need to provide a more "light weight" container for the community users and for our own better production experience. There are various technics to reduce the size of the container.

https://www.ctl.io/developers/blog/post/optimizing-docker-images/ http://www.developer.com/design/a-guide-to-docker-image-optimization.html http://blog.tutum.co/2014/10/22/how-to-optimize-your-dockerfile/

deruelle commented 8 years ago

http://thenewstack.io/microcontainers-iron-ios-new-hack-shrink-docker-containers/ I think it's worth investigating at some point indeed our docker image is too monolithic ideally we should layer it better create one for SIP Servlets that's layered on top of JBoss one and create the REstComm one layered on top of SIP Servlets when we think of it true, but I wonder at what cost all this comes... we don't need to download the whole zip everytime we just need to upgrade the war files and a couple of conf files which is much less than 300 MB every time

deruelle commented 8 years ago

Breakdown of our usage https://imagelayers.io/?images=mobicents%2Frestcomm:latest

leftyb commented 8 years ago

Amazing application.

Thank you Jean.

hamsterksu commented 7 years ago

hi @deruelle @leftyb i have split restcomm docker image to 2 images:

  1. restcomm/baseimage:java7 - 861 MB
  2. restcomm/restcomm - 1.127 GB (include 861MB base image)

Container's update size ~ 270 MB

https://github.com/hamsterksu/restcomm-docker-v2/tree/master

solution 2

i think it's possible to split it to 3 images

  1. restcomm/baseimage:java7
  2. restcomm/restcomm-sip-servlets:as7
  3. restcomm/restcomm

but in this case we need to move a lot of changes in restomm-sip-servlets like there - https://github.com/RestComm/Restcomm-Connect/blob/master/release/build.xml#L151 i'm not sure it's good idea

solution 3

Another possible solution split it to 3 images

  1. restcomm/baseimage:java7
  2. restcomm/restcomm-base:as7
  3. restcomm/restcomm

to build restcomm/restcomm-base:as7 we can download restcomm-connect AS7 and remove all wars from deployments except sip-servlets and webrtc and mediaserver

so restcomm/restcomm will bring restcomm, olympus, restcomm-management, visual-designer and mediaserer apps only

solution 4

Another possible solution split it to 5 images

  1. restcomm/baseimage:java7
  2. restcomm/restcomm-base:as7 (sip-servlets, webrtc)
  3. restcomm/restcomm:as7 (restcomm, restcomm-management)
  4. restcomm/mediaserver:as7 (mediaserver)
  5. restcomm/olympus:as7 (olympus)

and use docker compose to run restcomm

to use all in one

WDYT?

hamsterksu commented 7 years ago

option 4 is here - https://github.com/hamsterksu/restcomm-docker-v2/tree/option_4

deruelle commented 7 years ago

@hamsterksu nice !

Would you like to make a pull request so that @leftyb can review ?

hamsterksu commented 7 years ago

@deruelle i have not tested solution #4 pretty well. it's just a concept. i want to know your opinion

deruelle commented 7 years ago

@gvagenas @leftyb can you comment on that ?

leftyb commented 7 years ago

Hi @hamsterksu,

Thank you for the suggestion. I will need to make some tests following this approach to confirm. I am not sure that this approach is changing the download size, as by default docker updates only the layers that have changed, when you update a container. So maybe at the first update after pulling the container will result in less downloadable data, but after that, for pulling just new container where RC version/build has only been changed maybe the data to download will be the same, with the way we are using it now. But I can not say 100% will try to make some tests and will update.