Docker compose is a docker orchestration tool. You can use docker-compose to define and run multiple docker within single one docker-compose.xml.

The containers that are defined in same docker-compose.xml are visible to each other, that means they can visit each other.

Environment variables

You can define environment variables, and let docker-compose pick them up. For command line, passing an environment variable like below:

API_KEY=total-secret-key docker-compose up

If there are multiple variables, put them in .env file, or in a different file name and pass to docker-compose via --env-file argument.

Start up

Locate to the folder that contains docker-compose.yml:

docker-compose up

Shutdown

Recommend use this command to cleanup:

docker-compose down -v