belaassal
belaassal

Reputation: 133

Docker multi serivces in a single container

is it a good practice to create one dockerfile with all needed container , ex :

1 - FROM ubutnu

2 - RUN apt install php7.4

3 - RUN apt install mysql-server

4 - RUN apt install nginx

5 - RUN apt install openssh-server
......

Upvotes: 4

Views: 59

Answers (2)

Adi Dembak
Adi Dembak

Reputation: 2536

This is actually a bad idea. The principle of containers is one service per one container.

A container is really just a process. You might run 50 different containers on a machine, with very little overhead, and still gain the advantages of isolation for each service.

A good primer on the inherent differences between containers and VMs

Upvotes: 1

Olivier Audry
Olivier Audry

Reputation: 21

the service you are looking for is kubernetes and called pod and/or deployment.

You can put nginx/php in two separate container into the same pod and the mysql-server in another pod.

Upvotes: 0

Related Questions