Docker compose orchestrates an environment to run multi-container Docker applications. In layman’s language, it enables you to bring multiple containers together to make an application.
Docker compose makes use of a yaml file to define services that are later used to start and run the application with a single command.
Initially, you will have to make the respective Dockerfiles and set up the environment according to the application’s need. Then, download all the dependencies and install all the packages.
A typical docker-compose.yml file looks like this:
services:
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/code
- logvolume01:/var/log
links:
- redis
redis:
image: redis
volumes:
logvolume01: {}
web
build from Dockerfile in the parent directory.port to ..) is mapped to /code, and dictionary (logvolume01) is mapped to /var/log in the container.links to the redis container.redis
redis image.After the yaml file is set up, run:
docker-compose up
This will start up the services specified in the yaml files.
docker-compose.yml so they can be run together in an isolated environment.docker-compose up and Compose will run your entire app.Free Resources