The example in the previous section was fun but did not really gain us anything over using the
docker command. Most Internet applications have multiple pieces. The most common example is a web application that loads data from a database.
ch02/web-db of the
docker-orchestration-examples repository there is a very simple application that loads a list of authors and books from MySQL and displays them on a web page. Here is a
docker-compose.yml that defines the application:
version: '2' services: web: image: web-db:0.1 build: . ports: - 80:5000 env_file: - db.env entrypoint: ./start.pl --init --command shotgun db: image: mysql:5.7 env_file: - db.env
The first thing that you should notice is that there are two
services defined. The first,
web, is the web application. The second,
db, is a MySQL container. Let's look at them one...