which is better to use between Dockerfile and docker compose?

0 votes

Dockerfiles are used in Docker Compose, but I am not sure if it is good practice to put everything in one large Dockerfile with multiple FROM commands for the different images ?

I want to use several different images that include:

nginx
postgres
redis
rabbitmq
celery with cro

what is the best practice in setting up this type of environment using Docker?

Can anyone help me with this?

Nov 6, 2018 in Docker by Shubham
• 1,000 points
147 views

1 answer to this question.

0 votes
Here is a concept that will help you decide.

Docker Compose is used the Dockerfile if you add the build command to your project's docker-compose.yml.

 Docker workflow should be to build a suitable Dockerfile for each image you wish to create, then use compose to assemble the images using the build command.

You can specify the path to your individual Dockerfiles using build /path/to/dockerfiles/blah where /path/to/dockerfiles/blah is where blah's Dockerfile lives.

I hope the above explanation will help you get some clarity.
answered Nov 6, 2018 by Damon Salvatore
• 5,510 points

Related Questions In Docker

0 votes
1 answer

Is it possible to use JSON instead of YAML for docker-compose file?

You can use JSON instead of YAML ...READ MORE

answered Jul 2 in Docker by Sirajul
• 35,810 points
59 views
0 votes
1 answer

What is the difference between “expose” and “publish” in Docker?

Basically, you have three options: Neither specify EXPOSE nor -p -> ...READ MORE

answered Jul 18, 2018 in Docker by Nilesh
• 6,880 points
425 views
0 votes
1 answer

How to continue running a docker container which is already exited?

Restart an existing container after you exited ...READ MORE

answered Jul 19, 2018 in Docker by Sophie may
• 9,850 points
126 views
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,900 points
216 views
0 votes
1 answer
0 votes
2 answers

What is the difference between a Docker image and a container?

Here is very basic explanation for image ...READ MORE

answered Sep 4, 2018 in Docker by Damon Salvatore
• 5,510 points
893 views
0 votes
1 answer