There are several approaches to integrate dockers according to the project structure.

Docker-compose approach

  1. In this approach, each module (web, server, database) resides in different containers.
  2. We have to write different docker files for each
  3. There will be different images for each also.
  4. Only the thing is docker-compose is another top-level file that binds and connects all those images in one project.
  5. It is the standard approach that helps in the micro-system approach.
  6. Here initially we have tried it for our project and then switched to another approach.

How docker-compose works?

  1. Use YAML files to configure application services (docker-compose.yaml)
  2. Can start all the services with a single command ( docker-compose up )
  3. Can stop all the service with a single command ( docker-compose down )
  4. Able to scale up the specific services when required.
  5. Works in all environments: production, staging, development, testing, as well as CI workflows

Docker-compose file looks like

version: '3'
  1. db — it is a database used by the project
  2. server — It is a server-side module
  3. web — it is web side module.
  4. Build, image, port, environment are configurations which helps in building image and linking images with each other.

For more details about the docker-compose approach and implementation go through the following reference links.

  1. https://docs.docker.com/compose/
  2. https://www.tutorialspoint.com/docker/docker_compose.htm

Software Engineer. (Mobile and Web)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store