Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a Compose file to configure your application's services. Then, using a single command, you create and start all the services from your configuration. To learn more about all the features of Compose see the list of features.
Compose is great for development, testing, and staging environments, as well as CI workflows. You can learn more about each case in Common Use Cases.
Using Compose is basically a three-step process.
- Define your app's environment with a
Dockerfile
so it can be reproduced anywhere. - Define the services that make up your app in
docker-compose.yml
so they can be run together in an isolated environment. - Lastly, run
docker-compose up
and Compose will start and run your entire app.
A docker-compose.yml
looks like this:
version: '2'
services:
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/code
redis:
image: redis
For more information about the Compose file, see the Compose file reference.
Compose has commands for managing the whole lifecycle of your application:
- Start, stop and rebuild services
- View the status of running services
- Stream the log output of running services
- Run a one-off command on a service
- Full documentation is available on Docker's website.
- Code repository for Compose is on GitHub.
On Linux, you can download the Docker Compose binary from the Compose repository release page on GitHub. Follow the instructions from the link, which involve running the curl
command in your terminal to download the binaries. These step by step instructions are also included below
- Run this command to download the latest version of Docker Compose:
$ sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
- Apply executable permissions to the binary:
$ sudo chmod +x /usr/local/bin/docker-compose
- Optionally, install command completion for the
bash
andzsh
shell. - Test the installation.
$ docker-compose --version
docker-compose version 1.18.0, build fdd22a9
Component | Location |
---|---|
Graphdb | bigdatagrapes/graphdb |
Sparkling-water | bigdatagrapes/sparklingwater |
Virtuoso | bigdatagrapes/virtuoso |
Neo4j | bigdatagrapes/neo4j |
Hbase | bigdatagrapes/hbase |
Kafka | bigdatagrapes/kafka |
Flink | bigdatagrapes/flink |
Flume | bigdatagrapes/flume |
Kibana | bigdatagrapes/kibana |
Elasticsearch | bigdatagrapes/elasticsearch |
Spark-master | bigdatagrapes/spark-master |
Spark-worker | bigdatagrapes/spark-worker |
Hadoop | bigdatagrapes/hadoop |
PhpMyAdmin | bigdatagrapes/phpmyadmin |
Mysql | bigdatagrapes/mysql |
Tomcat | bigdatagrapes/tomcat |
Cassandra | bigdatagrapes/cassandra |
Mongo | bigdatagrapes/mongo |
Logstash | bigdatagrapes/logstash |
To help with the deployment of the stack there are 2 scripts present:
- deploy.sh, that deploys the whole stack, and
- destroy.sh, that clears everything running as a docker container in the VM executed.
Both these scripts should be executed as root.