Task01
Tools Review

What is Docker Compose

Docker Compose is a tool for defining and running multi-container Docker applications. It allows you to define your application's services, networks, and volumes in a single file, called a 'docker-compose.yml' file, and then start and stop all services from this file. This simplifies the process of managing complex applications, as you can define all aspects of your application in one place.

Working with Docker Compose

Quick Tip

You can hover over the Visual Studio Code Terminal example below to make a Copy button appear on the right hand side. Go ahead and try it now. Then just click the Copy button to copy the command and paste it into the terminal to bring up the file in your VSCode editor to make changes to the file. This functionality will be available in many of the tasks throughout this lab.

Step 1 - Review Docker Compose


code -r /home/cisco/CiscoLive/DEVWKS-2135/docker-compose.yml

Copy the content below to the docker-compose.yml playbook file and press Ctrl+s to save the file.



version: "2.1"
services:
  yangsuite:
    container_name: yangsuite
    image: yangsuite:latest
    build:
      context: ./yangsuite
      dockerfile: ./Dockerfile
    env_file:
      - ./yangsuite/setup.env
    command: /yangsuite/migrate_and_start.sh
    volumes:
      - static-content:/ys-static
      - uwsgi:/yangsuite/uwsgi
      - ./ys-data:/ys-data
  nginx:
    container_name: nginx
    image: nginx:latest
    build:
      context: ./nginx
      dockerfile: ./Dockerfile
    depends_on:
      - yangsuite
    ports:
      - "80:80"
      - "8443:8443"
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - static-content:/etc/nginx/html
      - uwsgi:/var/run/uwsgi

volumes:
  static-content:
  uwsgi:
     

Step 2 - Run Docker Compose

Run the docker-compose.yml file via the below command.


docker-compose up

Step 3 - Confirm The Containers Have Started Correctly

Check Docker Compoes Output

If the output is not similar to the below output, please notifiy the lab instructor


      ➜  DEVWKS-2135 ✗ | docker-compose up
 
    [+] Running 2/0
    ⠿ Container yangsuite  Created                                                                                                                                                                             0.0s
    ⠿ Container nginx      Created                                                                                                                                                                             0.0s
     Attaching to nginx, yangsuite
     nginx      | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
     nginx      | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
     nginx      | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
     nginx      | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist
     nginx      | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
     nginx      | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
     nginx      | /docker-entrypoint.sh: Configuration complete; ready for start up
     yangsuite  | /usr/local/lib/python3.6/dist-packages/ysdevices/utilities.py:4: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography (40.0) will be the last to support Python 3.6.
     yangsuite  |   from cryptography.fernet import Fernet
     yangsuite  | 2023-02-02 11:25:34,475 - yangsuite.ysgnmi.gnmi: WARNING: Install yangsuite-testmanager for opfield verification
     yangsuite  |


  • Introduction
  • Lab Environment and Topology
  • Streaming Telemetry Overview
  • Tools Overview
  • TIG Stack
  • Browse YANG Suite
  • Bonus Task!
  • Thanks