Completek8s Classroomnotes 12/Jul/2023

YAML

  • YAML is key value or name value pair collection
<name>: <value>
  • Lets try to understand with an example of sports club
    • name: ltsportsclub
    • branches:
      • Ameerpet
        • indoor
          • carrom
          • bowling
          • chess
          • ludo
        • outdoor
          • badminton
          • volley ball
          • swimming
      • KPHB
        • indoor:
          • carrom
          • bowling
          • chess
          • ludo
        • outdoor
          • badminton
          • volley ball
          • swimming
          • cricket
      • Gachibowli
        • indoor:
          • bowling
          • playstation
          • snooker
        • outdoor
          • badminton
          • volley ball
          • swimming
          • cricket
          • golf
  • Sample yaml
---
name: ltsportsclub
headoffice: 
  address:
    flatno: 407
    building: mytrivanam
    street: ameerpet main road
    area: Ameerpet
    city: Hyderabad
    pincode: 500082      
  mobile: 9999999999
  email: headoffice@ltsportsclub.com
branches:
  - ameerpet:
      sports:
        indoor:
          - carrom
          - chess
          - bowling
          - ludo
        outdoor:
          - badminton
          - volley ball
          - swimming
      address:
        flatno: 408
        building: ameerpet main
        street: ameerpet main
        city: Hyderabad        
      mobile: 88888888888
      email: ameerpet@ltsportsclub.com
  - kphb:
      sports:
        indoor:
          - carrom
          - chess
          - bowling
          - ludo
        outdoor:
          - badminton
          - volley ball
          - swimming
          - cricket
      address:
        flatno: 408
        building: kphb main
        street: kphb main
        city: Hyderabad        
      mobile: 88888888888
      email: kphb@ltsportsclub.com
  - gachibowli:
      sports:
        indoor:
          - carrom          
          - bowling
          - snooker
        outdoor:
          - badminton
          - volley ball
          - swimming
          - cricket
          - golf
          - tennis
      address:
        flatno: 408
        building: gachibowli main
        street: gachibowli main
        city: Hyderabad        
      mobile: 88888888888
      email: gachibowli@ltsportsclub.com
  • Note: YAML Tutorial Refer Here
  • YAML Types:

    • Simple:
      • Text
      • Number
      • boolean: true/false yes/no
    • complex
      • list/array (-)
      • dictionary/map/object
  • Schema: yaml schema represents structure of yaml which we would be authoring

Docker Compose

  • Refer Here for docker compose reference
  • Basic structure
---
version: string
services: 
networks:
volumes:
configs:
secrets:

Activity: execute these by using docker cli

  • create a nginx container expose 80 port to any port
  • create an apache container expose 80 to any port
  • create an jenkins/jenkins container: expose 8080 to any free port
docker container run -d -P nginx
docker container run -d -P httpd
docker container run -d -P jenkins/jenkins
  • docker-compose
---
version: "3.8"
services:
  nginx:
    image: nginx
    ports:
      - "80"
  apache:
    image: httpd
    ports:
      - "80"
  jenkins:
    image: jenkins/jenkins
    ports:
      - "8080"
  • Now create and start containers
    Preview
    Preview
  • lets view the containers and network
    Preview
    Preview
  • To remove whatever was created
    Preview

Activity 2:

  • Create a volume
  • Create a network
  • Create a mysql container and attach volume to /var/lib/mysql and run on the network created
  • Create a wordpress container and run on network created. WordPress should expose port 80
  • Docker-compose yaml
---
version: "3.8"
services:
  wordpress:
    image: wordpress
    networks:
      - wordpress-net
    ports:
      - 80
  mysql:
    image: mysql:8
    networks:
      - wordpress-net
    volumes:
      - wordpressdb:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: wordpress@123
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress@123
      MYSQL_DATABASE: wordpress
networks:
  wordpress-net:
volumes:
  wordpressdb:
  • bring up the containers
    Preview
  • Examine containers, network and volume
    Preview
  • Exercise:

    • Run the docker compose files in nop commerce Refer Here
      • with microsoft sql server
      • with mysql
      • with postgress
    • Refer Here and try to understand any docker-compose file run and explain what happens
  • Next Topics:

    • Containers on Windows

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

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

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube