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
3,046 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,980 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, 2019 in Docker by Sirajul
• 59,230 points
4,962 views
+2 votes
1 answer
+2 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
• 58,020 points
2,719 views
+1 vote
1 answer
0 votes
3 answers

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

Images are read-only templates that contain a ...READ MORE

answered Aug 10, 2020 in Docker by Vishal
• 260 points
6,675 views
0 votes
1 answer

Efficient way to run a Docker Compose stack in production?

Here is a concept which you can ...READ MORE

answered Aug 2, 2018 in Docker by Damon Salvatore
• 5,980 points
1,133 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP