Docker-compose File
The compose file is a YML file defining services, networks, and volumes for a Docker container. There are several versions of the compose file format available – 1, 2, 2.x, and 3.x.
version
refers to the docker-compose version (Latest 3)services
defines the services that we need to runapp
is a custom name for one of your containersimage
the image which we have to pull. Here we are usingnode:latest
andmongo
.container_name
is the name for each containerrestart
starts/restarts a service containerport
defines the custom port to run the containerworking_dir
is the current working directory for the service containerenvironment
defines the environment variables, such as DB credentials, and so on.command
is the command to run the service.
Last updated