<p>We always use different container for each service (Like Frontend ,Backend and Database). Because a container can run only a single service inside it at a time by using docker-compose.yml file. But we can define multiple services inside one docker-compose.yml file but one for each container.    </p>

CC BY-SA 4.0
2019-02-05T10:29:49.127Z
2019-02-05T10:29:49.127Z
user12220
<p>Are they separate projects (from a logical or technical perspective)? Would one ever need to be updated/recreated independently of the other one? Would they need to scale independently of each other? I think if any of those answers is a yes, then they should be separated. If not, you should be fine bundling them together. Bundling them together will reduce discrepancy or compatibility issues between the two containers.</p>

CC BY-SA 3.0
2017-09-26T18:42:22.920Z
2017-09-26T18:42:22.920Z
Preston Martin
<p>Imagine in your stack you have RESTful services which also provide some rudimentary frontends, mostly for admin/other tech user use.</p>

<p>Do you include the UI inside the container or are these two containers? Why?</p>

<docker><architecture>
Service backend/frontend in one or two containers?
Ta Mu
# Service backend/frontend in one or two containers?

(Asked by: username_0 on 2017-09-26)

Imagine in your stack you have RESTful services which also provide some rudimentary frontends, mostly for admin/other tech user use.

Do you include the UI inside the container or are these two containers? Why?

**Tags:** docker, architecture


---

## 2 answers

### Answer by username_2 on 2017-09-26. Score: 9 | Accepted answer

Are they separate projects (from a logical or technical perspective)? Would one ever need to be updated/recreated independently of the other one? Would they need to scale independently of each other? I think if any of those answers is a yes, then they should be separated. If not, you should be fine bundling them together. Bundling them together will reduce discrepancy or compatibility issues between the two containers.


---

### Answer by username_1 on 2019-02-05. Score: 2

We always use different container for each service (Like Frontend ,Backend and Database). Because a container can run only a single service inside it at a time by using docker-compose.yml file. But we can define multiple services inside one docker-compose.yml file but one for each container.


---

