Introduction to Docker Compose
Introduction to docker compose
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 create and start all the services from your configuration. To learn more about all the features of Compose, see the list of features.
Compose works in all environments: production, staging, development, testing, 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
Dockerfileso it can be reproduced anywhere.
- Define the services that make up your app in
docker-compose.ymlso they can be run together in an isolated environment.
docker-compose upand Compose starts and runs your entire app. source : https://docs.docker.com/compose/
sudo curl -L https://github.com/docker/compose/releases/download/1.20.1/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
Set permission executable
sudo chmod +x /usr/local/bin/docker-compose
Check docker-compose version
sudo docker-compose — version
Compose and Wordpress
create directory my_wordpress and enter the directory
create docker-compose.yml file
sudo docker-compose up -d
sudo docker container ls
Access Wordpress from browser