DEV Community

Aravind kumar TS
Aravind kumar TS

Posted on

Glimpse of Terraform, Docker, GitHub, Jenkins!!

Terraform -

It is a configuration language. Unlike Cloud formation in AWS using Terraform and its providers codes we can interact with any Cloud Environment.
Terraform - Terraform init - initializes the code
Terraform plan - Shows what are the resources getting created
Terraform apply - Implements the code to provision infrastructure
Terraform fmt - To find out syntax errors
Terraform state - Stores the resources that were created in a file known as state file
Terraform validate - Validates our code
Terraform version - Displays the version of Terraform we are using
Terraform Import - Imports the updated resources to the state file
Terraform state files are stored in S3 buckets

Terraform destroy - it destroys the environment

Docker
Docker hub - stores all images and are publicly available
Docker pull image name_ - helps us to download the images to the CLI
Docker images ls - lists the images that are present in local
Docker images inspect - lists the detailed history of images such as image id, image version etc
Docker image rm _image name
- removes the image downloaded to local
Docker containers create --tag name for the container image name -- will create a container
Docker ps - a --- lists all stages of container including idle ones
Docker run -it tags name for container image name /bin/sh - will create a container (os from the image)
Docker container stop container id _-. Will stop the running container
Docker file - to create a customized image
Docker file - to create a customized image for example an image with both alpine os and python package
Docker compose up execute this command from the path of directory - to create an application,
First, we have to create a directory in local and create another file called requirements.txt. Inside the existing directory create docker file and mention the image name, env name, input the requirements.txt file etc.
When we hit Docker compose it creates the application.
It can be accessed using http://localhost:port number of the application
Docker compose down - will bring down the running application including the container
Docker volume create __volume name _ - creates a volume, to mount the volume to containers we have other commands
By default, Docker containers are created in bridge network. We can create a container with unique bridge name.
The containers under same bridge network can interact with each other
To create a docker network the command is docker network create bridge name
We can also create a bridge network first with a unique name and then attach the network with a container.

Git

Git clone repository url - it downloads the repository along with its folders to local
Git branch Branch name - helps to create a new branch
Git checkout Branch name - To switch to a new branch
Git checkout -b Branch name - To create a new branch and to work from the branch
Git status - gives all information about current branch
When we edit a file under repo and when we want to commit it - git add -A
Git commit -m "message to commit" - will save the changes we did in a branch/repo locally
After committing changes, we need to push it to the repository - git push remote repo branch name
Git push - u origin branch name - it will upload the changes done on a branch including newly created branch to repository
Git pull - to get updates in local from remote repository
Git log -- online - gives us the history of commits
Git merge branch name - merges the branch with master
Git checkout master - to switch from branch to master
Whenever we work in GitHub, we must never work in Master we must always work in branch
-------github is over -----

Jenkins
To be continued ...

Top comments (0)