Docker compose
- This file helps in creating a single command start and destroy for the entire application.
- This is majorly used in developer environments.
- Docker compose file is written in YAML format.
YAML
- This is a file format which stores any data in the form of name value pairs
- Yaml is collection of key value pairs
key: <value>
- Values can be of multiple types
- Text:
- Number
- boolean
- list/array
- dict/object
- Example – 1
name: python
version: 3.12
docker: yes
standardlib:
- os
- sys
- argparse
- json
otherlib:
cli: click
aws: boto3
name: xyz
contact:
address:
city: Hyderabad
state: Telangana
email: xyz@khaja.tech
linkedin: linkedin.com/xyz
mobile: +91-9999999999
designation: Agentic AI Developer
summary: sumary
Docker compose yaml
Docker-compose file with nginx and mysql
- the command to run nginx is
docker run --name mynginx -p 80:80 -d nginx
- the command to run mysql s
docker run --name my-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -p 3306:3306 -d mysql
- create file called as
docker-compose.yml with following content
services:
web:
image: nginx
ports:
- 80:80
depends_on:
- db
db:
image: mysql
ports:
- 3306:3306
environment:
- MYSQL_ROOT_PASSWORD=my-secret-pw
- MYSQL_DATABASE=testdb
- Ensure docker desktop is started
- Now exectute
docker compose up -d
- View the containers in docker desktop
- if you want to delete
docker compose down, to remove images and volumes docker compose down -v --rmi
Docker-compose file with python & database
- Refer Here
- Exercise:
- Run this locally
- Build an mcp server for movie app to create, update,delete movies (tools), get movie (resource)
- Test this my linking mcp to claude use natural language to create movees.