DevOps Classroomnotes 26/Nov/2022

Docker Swarm Contd..

  • We have initialize the swarm cluster and created two services
    • nginx docker service create --replicas 2 --publish mode=host,target=80,published=8080 nginx
    • jenkins docker service create --replicas 2 --publish mode=host,target=8080,published=8081 jenkins/jenkins
  • To access them we have used 8080 port of any node in cluster
    Preview
  • To access jenkins we have used 8081 port of any node in cluster
    Preview

Docker-Compose

  • Docker compose lets run multiple containers in a Docker and also lets define the necessary volumes and networks
  • Hello-world docker compose. Create a file called as docker-compose.yaml
services:
  app:
    image: httpd
    ports:
      - "8080:80"
  db:
    image: mysql
  • now execute docker-compose up -d
    Preview
    Preview

Exercise:

  • Try running the flask application and database in a same bridge network Refer Here

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner