Docker Community Forums

Share and learn in the Docker community.

What is difference between docker compose and Dockerfile?

I am beginner at docker and I want to create a django-app image and I’ve found how to work Django app in docker doc but from doc, it wants to install docker-compose. I want to figure out is that different between Dockerfile and docker-compose? and Is docker-compose works only with Django or what ?

A dockerfile is used to build an image. A compose file is used to start, stop, or manipulate one or more containers, services, networks, and similar.

Compose works with many images and specifications; it’s not specific to Django. It’s likely that one or more services or containers need to be started and/or other things need to be setup prior to executing the application itself, which is why it wants compose. Or there could be something else going on with compose; I can’t say without diving deep into the specifics of the django-app image.