DevOps Classroomnotes 20/Apr/2023

YAML

  • This is data representation format, which uses name/value pairs
  • The basic format is <name>: <value>
topic: Docker
  • types of data

    • Simple/Scalar
      • Text
      • number
      • boolean
    • Complex
      • list/array
      • map/dictionary/object
  • Extension of YAML files is .yaml or .yml. YAML is a text file
  • Simple yaml
url: directdevops.blog
author: khaja
isDailyUpdated: true
isLoginRequired: false
articlecount: 1000
  • List example
---
Colors:
  - Black
  - White
Movies:
  - Avengers
  - Batman Begins
  • Map/Dictionary/object
---
Address:
  flatno: 407
  building: Mythrivanam
  area: Ameerpet
  city: Hyderabad
  • yaml about Quality Thought
---
name: QualityThought
url: https://qualitythought.in
courses:
  - name: Azure
    faculty: khaja
    duration: 90
  - name: AWS
    faculty: khaja
    duration: 90
  - name: DevOps
    faculty: khaja
    duration: 110
  - name: Manual Testing
    faculty: Ramana
    duration: 60
Branches:
  headoffice:
    flatno: 302
    building: nilgiri
    city: hyderabad
  devops:
    flatno: 407
    building: mythrivanam
    city: hyderabad
  • Try writing about yourself in a yaml according to following structure
---
#qualification
yearofpassing: <number>
university: <text>
grade: text (A+|A|B|C)
----
# education
<name>: <qualification>

----
name: <text>
mobile: <text>
email: <text>
education: list(<education>)
  • Example 1 (Postgraduate)
---
name: vishnu
mobile: '999999999'
email: vishnu@gmail.com
education:
  - mtech:
      yearofpassing: 2017
      university: jnu
      grade: A
  - btech:
      yearofpassing: 2015
      university: jntu
      grade: A+
  • Example (graduate – BSc)
---
name: Swathi
mobile: '88888888'
email: swathi@outlook.com
education:
  - BSc:
      yearofpassing: 2020
      university: osmania
      grade: A+
  • YAML will be used to define kuberentes manifests and docker compose files

Docker compose

  • This was external tool, but now it is integrated as docker subcommand docker compose
  • Compose allows use to specify the yaml file which helps in creating the below by specifying in a yaml file
    • networks
    • volumes
    • containers
  • docker compose file will have the name of docker-compose.yml
  • sample
---
version: '3.9'
services:
  web:
    image: nginx:latest
    networks:
      - hello-net
    volumes:
      - type: volume
        source: my-vol
        target: /tools
networks:
  hello-net:
    driver: bridge
volumes:
  my-vol:


  • to start all the containers create a folder copy the docker-compose.yaml and execute docker compose up -d and to remove every thing docker compose down
    Preview
  • Refer Here for the compose file with instructions to run student course register which we have executed manually yesterday

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner