T
T
topuserman2021-11-03 20:32:08
PHP
topuserman, 2021-11-03 20:32:08

How to structurally decompose different Dockerfiles for the same project?

I'm learning docker and want to make my first project on it.
As I understand it, each service should be in a separate container.
For example:
1. mysql
2. php-apache
3. redis
4. rabbitmq
5. data-storage

the result is 5 images that need to be built, because 5 Dockerfiles.

How structurally should they be properly organized? Really in a root of the project there should be 5 Dockerfile'of?

It seems to me that at the root of the project there should be only docker-composer.yaml which will already build and raise images from these Dockerfiles.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daria Motorina, 2021-11-04
@topuserman

The Dockerfile is needed only if the main image needs to be modified, so it is enough to specify the name of the main image in docker-compose.yml and set a couple of settings if they are initially supported (username, password, etc.). For example, I usually only need to register the php-fpm Dockerfile and sometimes for mysql, I put the rest of the images as they are

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question