07 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.
Open
docker-compose.yml
and examine the content of the file.Note :
- Internal name
- Container name
- Build
- Ports
- Volumes (data is external from the container)
To build and run the container run
docker-compose up
- Note we build the container in this example, but we could just as well, pull one from a registry.
- Refresh the browser to
http://studentip:80
and see the website is running again. - While it’s running, go to
html/index.html
and replacesrc="Devops-toolchain.svg.png">
withsrc="docker-compose.jpeg">
and save. - Refresh the website, and see it got a more fitting picture.
- Press
ctrl+c
to cancel the running container.