In this recipe, we will be deploying our favorite phonebook application using Docker containers. Referring to the code files, we have created a Dockerfile and added the steps to bake our application into a Docker image. Then, we created docker-compose.yml, in which we have added our service as a phonebook and mapped it to the port of the host container, which is 8080.
Deploying a sample application
How to do it...
Let's write a playbook for the application on how to build and run a phonebook service using ansible-playbook:
---
- hosts: localhost
roles:
- phonebook $ ansible-playbook --become phonebook.yml