Reading JSON and YAML in Python
As a DevOps Engineer, you should be able to parse files, be it txt, JSON, YAML, etc.
You should know what libraries one should use in Python for DevOps.
Python has numerous libraries like
os
,sys
,JSON
,YAML
etc that a DevOps Engineer uses in day-to-day tasks.
Tasks
Create a Dictionary in Python and write it to a JSON File.
Read a JSON file
services.json
kept in this folder and print the service names of every cloud service provider.
output aws : ec2 azure : VM gcp : compute engine
Read YAML file using python, file
services.yaml
and read the contents to convert yaml to jsonDay 16 Task: Docker for DevOps Engineers.
Docker
Docker is a software platform that allows you to build, test, and deploy applications quickly. Docker packages software into standardized units called containers that have everything the software needs to run including libraries, system tools, code, and runtime. Using Docker, you can quickly deploy and scale applications into any environment and know your code will run.
Tasks
As you have already installed docker in previous days tasks, now is the time to run Docker commands.
Use the
docker run
command to start a new container and interact with it through the command line. [Hint: docker run hello-world]Use the
docker inspect
command to view detailed information about a container or image.Use the
docker port
command to list the port mappings for a container.Use the
docker stats
command to view resource usage statistics for one or more containers.Use the
docker top
command to view the processes running inside a container.
Use the
docker save
command to save an image to a tar archive.Use the
docker load
command to load an image from a tar archive.
These tasks involve simple operations that can be used to manage images and containers.
## <mark>Day 17 Task: Docker Project for DevOps Engineers.</mark>
### You people are doing just amazing in **#90daysofdevops**. Today's challenge is so special Because You are going to do DevOps project today with Docker. Are You Exited ๐
# Dockerfile
Docker is a tool that makes it easy to run applications in containers. Containers are like small packages that hold everything an application needs to run. To create these containers, developers use something called a Dockerfile.
A Dockerfile is like a set of instructions for making a container. It tells Docker what base image to use, what commands to run, and what files to include. For example, if you were making a container for a website, the Dockerfile might tell Docker to use an official web server image, copy the files for your website into the container, and start the web server when the container starts.
For more about Dockerfile visit [here](https://rushikesh-mashidkar.hashnode.dev/dockerfile-docker-compose-swarm-and-volumes)
task:
* Create a Dockerfile for a simple web application (e.g. a Node.js or Python app)
* Build the image using the Dockerfile and run the container
* Verify that the application is working as expected by accessing it in a web browser
* Push the image to a public or private repository (e.g. Docker Hub )
# **<mark>step1: clone your code from GitHub</mark>**
![](https://cdn.hashnode.com/res/hashnode/image/upload/v1673898502049/81e72926-48ef-4b01-96a4-6562ddf50646.png?auto=compress,format&format=webp align="left")
Step 2: Check the requirements.txt
Step 3: write the docker file according to project requirements.
step 4: build the image
step 5: run the image and create the container
step 6: go to your AWS security inbound group and enable port 8001
according to your project, you enable your port
this is written in requirements.txt
step 7: and then open a new tab and paste your IP(public) for your instance and then your port according to this picture and finally code is running