Docker compose lets us define a deploy a multi-container app very easily.
Complete the docker-compose.yaml
configuration file:
- Link the
mysql
service container to thejupyter
service container; - Mount the data volume
workshop-docker-mysqldata
to the mount-point/var/lib/mysql
.
version: '3'
# Containers to be instantiated in environment
services:
jupyter:
image: workshop-docker/example4
ports:
- "8888:8888"
volumes:
- ./notebooks:/tmp/notebooks
links:
- <mysql-container-service-name>
mysql:
image: mysql/mysql-server
volumes:
- <data-volume>:<mount-point>
# External volumes for the declared services
volumes:
workshop-docker-mysqldata:
external:
name: workshop-docker-mysqldata
Now that you've done all the hard work of defining images and containers, running everything is easy!
$ docker-compose up
Shutting the application down is equally easy:
$ docker-compose down