Right way to build LAMP +Java environment


I am new to Docker’s world. I have been working with vagrant for quite a few months but Docker seems to be more efficient.

Right now I am struggle with a question that in order to setup a scaleable architecture (development vs production) is it better to create separate containers for PHP, MySQL, Java (Spring) where they all are using same Operating system or should I put them on a single container during development and then create separate containers for productions?

Expert insights is needed. :slight_smile:

This is a loaded question.
Following is a very simple answer:
If you have a monolithic application running as VM, first step would be to convert the monolith application to a single container. This gives great benefit of portability. As a next step, you can break the monolith application into microservices with each microservice running as container. In your case, microservice could be php app, mysql database, java app. This would give the additional benefit of scalability, maintainability and a devops workflow.


Thanks Sreevinas for the insight, so what I understand is I should use Docker compose and on that I run all these micro services. Right?

Other than that, do I need to have an OS image or a VM if my host is MAC or Ubuntu. Coming from Vagrant environment I am confuse here and want to understand how can I better leverage the right potential of Docker.

Docker compose is a great developer tool to build application containing multiple containers with each container implementing a micro service.

Docker containers runs on bare-metal, VM or cloud. Thats the beauty of Docker containers, its completely portable. You just need to install Docker CE or EE editions. Docker runs natively on Mac, Windows and Linux. For folks starting on Docker, there is confusion with Docker base image. Containers are built on top of base images. Common Docker base images are alpine, ubuntu etc. Base images does not mean that this has the complete OS. ubuntu container base image just means that it has the ubuntu tools and libraries.