January 8, 2021 / Eternal Team
Docker Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you can create and start all the services from your configuration.
Step 1: First we Download and Install Docker Compose
curl -L https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
Step 2: Change Permissions
chmod +x /usr/local/bin/docker-compose
Step 3: Check Docker Compose version
docker-compose --version
Let see how to use compose the file with an example.
Fist first let’s see how docker file look like.
version: "3.8" services: web: build: ports: - "5000:5000" volumes: - .:/code - logvolume01:/var/log links: - redis redis: image: redis volumes: logvolume01: {}
And save it docker-compose.yml
And hit the below command
#docker-compose up -d
And your Redis is running in port number 5000. To read more on Docker Compose, visit the Documentation Page.