Thursday, July 8, 2021

Docker-Learn2

docker version

//Server and client versions specified

//Client can talk to server


docker info

//Detailed Info and configuration


docker

//List of all command


docker management_command subcommand

in 2017 it was revamped

docker container  run    [new]

docker run [old]


docker container run -it --rm alpine:latest '/bin/sh'










Docker-Learn1

https://itnext.io/chroot-cgroups-and-namespaces-an-overview-37124d995e3d

https://www.youtube.com/watch?v=8fi7uSYlOdc

https://www.docker.com/play-with-docker



https://www.docker.com/101-tutorial     [<<<<<<<<<<<<<<<BEGIN Here<<<<<<<<<<<<]

docker run -dp 80:80 docker/getting-started 


docker <command> --help

docker run -d -p --rm -it IMAGE "startupCommand"

-d        detached mode in console

-p       HostPort:DockerPort

-i         make it interactive

-t        make a pseudo tty

--rm   remove once container stopped/exited

docker start containerID

docker stop ContainerID

docker rm containerID

docker ps -a

docker ps 


CONTAINERID          IMAGE           COMMAND             CREATED          STATUS          PORTS             NAMES


docker rm 10c997a681fa


https://towardsdatascience.com/learn-enough-docker-to-be-useful-b0b44222eef5

https://www.freecodecamp.org/news/a-beginner-friendly-introduction-to-containers-vms-and-docker-79a9e3e119b/


https://phoenixnap.com/kb/grep-command-linux-unix-examples


Recall that a Docker container is a Docker image brought to life

A Dockerfile instruction is a capitalized word at the start of a line followed by its arguments. Each line in a Dockerfile can contain an instruction.


Only the instructions FROM, RUN, COPY, and ADD create layers in the final image. 

Other instructions configure things, add metadata, or tell Docker to do something at run time, such as expose a port or run a command



Some docker commands have subcommands

Example

docker image ls

docker image rm 

docker image build

docker image pull


docker pull hello-world

docker rm 057c5b1edd19 2da87d301ae6


An image being referenced by container cannot be removed even if a container is itself "Exited/Stopped"

You have to either rm the container or use -force with image

docker rm CONTAINERID 

docker image rm image1 image2



Docker-Learn

 docker version

docker info

docker command --- In 2017 Introduced "management commands" and  "subcommands"


docker image --help

docker container --help


docker container run --publish 80:80 nginx


docker container ls  //Only shows running containers


docker container ls -a    //All containers including stopped ones


docker container run --publish 80:80 --name webhost --detach nginx     //Container name has to be unique as well

                                                                                                                                           //cannot conflict with stopped container name as well


docker container stop fb7 webhost2                  //I mixed containerId and containerName, Can't stop running container as well


 docker container logs --follow  containerID                         //Tailing Logs

Wednesday, July 7, 2021

Browser : Chrome: Mixed Content, Http/Https

https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content/How_to_fix_website_with_mixed_content

https://blog.chromium.org/2020/02/protecting-users-from-insecure.html


How to fix your website

The best strategy to avoid mixed content blocking is to serve all the content as HTTPS instead of HTTP.

AWS:CloudShell:CLI: aws ec2 describe-instances

https://thehftguy.com/2016/03/10/how-to-export-amazon-ec2-instances-to-a-csv-file/

https://gmusumeci.medium.com/how-to-export-aws-ec2-instances-in-multiple-aws-regions-and-multiple-aws-accounts-to-excel-csv-ce283af0ed90

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Filtering.html

https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html

https://docs.aws.amazon.com/cloudshell/latest/userguide/working-with-cloudshell.html


AWS Cloud Shell 

aws ec2 describe-instances --filters "Name=tag:Environment,Values=QA"  --output json

aws ec2 describe-instances --filters "Name=tag:Environment,Values=QA" --output table  >  QA_EC2_Instances.tsv


InstanceId

InstanceType

PrivateIpAddress


aws ec2 describe-instances \

--filters "Name=tag:Environment,Values=QA" \

--query 'Reservations[*].Instances[*].{InstanceId:InstanceId,InstanceType:InstanceType,PrivateIpAddress:PrivateIpAddress}' \

--output json \

>  QA_EC2_Instances.json



aws ec2 describe-instances --filters Name=instance-state-name,Values=running --query "Reservations[*].Instances[*].InstanceId" --output text


aws iam list-access-keys --user-name  john_doe

aws iam list-access-keys --user-name  john_doe

AWS : Exam:Practice Exam:Mock Exam: Cloud Practioner

https://geekflare.com/aws-practice-test/


https://digitalcloud.training/certification-training/

https://digitalcloud.training/certification-training/aws-certified-cloud-practitioner/

https://digitalcloud.training/courses/free-aws-certified-cloud-practitioner-practice-exam/


https://www.testpreptraining.com/


https://www.whizlabs.com/cart/ 

WELCOME


https://karanawsbucket.s3.us-east-1.amazonaws.com/Blogger_Images/products_whizcard-clf-c01-01-06.pdf

https://karanawsbucket.s3.us-east-1.amazonaws.com/Blogger_Images/products_csaa-whizcard-_-revised_14_06_2021.pdf

Azure : Devops : Pipeline :YAML

 You can organize pipeline jobs into stages. Stages are the major divisions in a pipeline: "build this app", "run these tests", and "deploy to pre-production" are good examples of stages. They are logical boundaries in your pipeline where you can pause the pipeline and perform various checks.


Pipeline > Stages >Stage>Steps>Step


jobs:

- job: A

  steps:

  - bash: echo "A"


- job: B

  steps:

  - bash: echo "B"

  

  

  If you organize your pipeline into multiple stages, you use the stages keyword.


If you choose to specify a pool at the stage level, then all jobs defined in that stage will use that pool unless otherwise specified at the job-level

stages:

- stage: A

  jobs:

  - job: A1

  - job: A2


- stage: B

  jobs:

  - job: B1

  - job: B2

  

  When you define multiple stages in a pipeline, by default, they run sequentially in the order in which you define them in the YAML file. The exception to this is when you add dependencies. With dependencies, stages run in the order of the dependsOn requirements

  stages:

- stage: string

  dependsOn: string

  condition: string

  -----------------------------------------------------------

  You can organize your pipeline into jobs. Every pipeline has at least one job. A job is a series of steps that run sequentially as a unit. In other words, a job is the smallest unit of work that can be scheduled to run.

  

  In the simplest case, a pipeline has a single job. In that case, you do not have to explicitly use the job keyword

  

  jobs:

- job: myJob

  timeoutInMinutes: 10

  pool:

    vmImage: 'ubuntu-16.04'

  steps:

  - bash: echo "Hello world"

  

  

  /usr/lib/jvm/adoptopenjdk-11-hotspot-amd64



 # update-alternatives --config java

          update-alternatives --list java

          echo ls /etc/alternatives

          ls /etc/alternatives

  

  

https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml

https://docs.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops


https://faun.pub/reduce-your-build-time-using-caching-in-azure-pipelines-7a7bd0201cee


MAVEN_CACHE_FOLDER: $(HOME)/.m2/repository"


variables:

  MAVEN_CACHE_FOLDER: $(HOME)/.m2/repository

  MAVEN_OPTS: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'


- task: Cache@2

  inputs:

    key: '"funcs" | maven |"$(Agent.OS)" | **/pom.xml'

    restoreKeys: |

    path: $(MAVEN_CACHE_FOLDER)

  displayName: Cache Maven local repo

  

https://stackoverflow.com/questions/66161852/is-there-a-predefined-variable-for-home-vsts-in-azure-pipelines/66161853#66161853

  

  

Pool: Hosted Ubuntu 1604

Agent: Hosted Agent



Pool: Azure Pipelines

Image: ubuntu-16.04

Agent: Hosted Agent

Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass