简体   繁体   中英

How to setup docker containers for 2 applications

I have two teams first one writing backend on laravel second team writong front on react. How better orginize docker container. create 1 container for 2 projects or create 2 different containers?

I think creating 2 containers is better:

  • You have your frontend completely seperated from your backend.
  • You can redeploy your frontend / backend without the other part (only update frontend / only update backend)
  • Your deploys are smaller
  • Bugs should be easier to find (Was that system error in container A or B?)
  • You can easier replace a container, for example when you want to show a maintenance screen while the api is running in the background. (replace the frontend container with the maintenance container eg)
  • You can build, run and test only the frontend / only the backend and don't need both parts at anytime

But this only works when your react application is standalone (what it is if it's a react application), that means it should work "by itself" and only consume the API (REST / GraphQL / WebSocket) of the backend.

However, there are also some things to keep track of:

  • If you make a breaking change to the interface (API etc.) you have to deploy both containers at once to prevent incompatibility errors / downtime

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM