docker tut

docker imp commands 
--------------------

1) docker images 

2) your could also  pull a image and then run it saperately
docker pull centos:centos6        --> centos6 is the tags 

2) docker run docker/ubuntu
or 
2) docker run docker/ubuntu /bin/echo "hello world"
or 
2) docker run -d ubuntu for i  in `cat file`;do echo $i > file ;done 





3) see containers if running 
docker ps -a or docker ps 


4) To createa custom images  

a) mkdir customedocker/ ; cd customedocker

b) vi dockerfile 
FROM ubuntu:latest

RUN apt-get -y update && apt-get install -y vim

CMD ls -al



c) docker build -t dockername1 .

d) docker run dockername1

5) remove containers 
docker rm containerID 
   
   remove images 
docker rmi imageid 


6) running a webserver 

a) docker run -P -d --name web1 nginx 
b) docker port web1
c) docker stop web1
d) docker start  web1
7) running a webserver with custom mount points  

a) cd /var/www ; eccho "hello web" > index.html
b) docker run -P -d  --name web nginx   -v /var/www:/usr/share/nginx/html:ro -v /var/nginx/conf:/etc/nginx:ro



8) how to start a container and jump to command line 
docker run -ti ubuntu /bin/bash


9) start container in background  and run command in loop in container 

docker run -P -d --name web1 nginx /bin/sh -c "while true ; echo \"i am doing \"  ; sleep 1 ;done "

docker logs web1   < --- you will see whats running on the machine 


10) if I need to move back to the one  of the container terminals 

 docker exec -it container-id bash

11 ) after making chnages to a container we need to commit those changes 

docker commit -m "some changes " -a "your user name" container-id aggeorge/nginx.01:v2

docker push aggeorge/nginx.01:v2

12) To see your history of commits 

docker histroy aggeorge/nginx.01


13) set up of a wordpress website x 

a) docker run --name wordpresmyql -e MYSQL_ROOT_PASSWORD=password -d mysql 
b) docler ps -l 
c) docker run -name mywordpress --link wordpresmyql:mysql -P -d wordpress
d) docker port mywordpress or docker ps -l 
e) http://localhost:portnumber



14 ) installing docker compose 

curl -L https://github.com/docker/compose/releases/download/1.7.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

$ chmod +x /usr/local/bin/docker-compose



14) documentatin on docker compose 


15) wordpress installation 












































devops test



----------------------------------------------------------------------------------------------------------------------
DEVOPS TEST 1
----------------------------------------------------------------------------------------------------------------------

The assignment expects you to set up one click deploy and provisioning of an environment with all neccesary elements of a DevOps Toolchain. Use Puppet / Chef / Ansible for the following setup 1. Apache tomcat server 2. Mysql Database, with configuration controlled through the tool 3. Apache Http Webserver 4. Web loadbalancer on Apache Server for Tomcat. 5. Jenkins for CI
With the setup in place 1. Make a continuous delivery (CD) pipeline in AWS using Jenkins, it should include CI Builds and other jobs neccesary for the software delivery lifecycle 2. Create a DevOps Toolchain to completely automate the pipeline, the tool chain should be able to auto provision and remove on-demand environments, along with devops toolchain hooked into every environment that gets provisioned 3. Push a built WAR using Jenkins build pipeline into the VM 4. Also make sure that the location of tomcat and apache HTTPD should be flexible and controlled by Puppet/Chef/Ansible, in case no specific value is provided it should fall back to defaults NOTES: 1. You can make any assumptions and be as innovative and creative as possible in your usage of tools for DevOps tool-chain 2. You are expected to implement a CD pipeline with no use of shell scripts 3. Check-in the complete project (cookbooks, manifests, Jenkins build definitions etc.) into a GitHub account and send us the repository location 4. Use the spring application https://github.com/spring-projects/spring- petclinic/ as source for the CI And CD implementations. 5. Feel free to use AWS and share the working installation URL also, any charges incurred will be repaid irrespective of the interview result. 6. Recommended tool for AWS : Vagrant

------------------------------------------------------------------------------------------------------------------------
DEVOPS TEST 2
------------------------------------------------------------------------------------------------------------------------
Imagine you're part of a team that is starting a blogging application that would eventually run on the cloud (let's assume it's AWS). The team has decided to use Wordpress to get a simple blog running as a start. Your team of developers are going to be adding features to the blog. To help them speed their releases to Production, you want to template and automate building EC2 servers and a suitable AWS infrastructure.
First, you create Amazon AWS resources in a repeatable manner, using input parameters that will take default value and non-default values based on configuration file. You need to use Terraform in conjunction with Ansible to achieve this.
While the developers are writing code, you want to allow them to deploy code themselves. They should be able to deploy the blog app remotely using a simple command.

Here are the specs you want:
- OS: Ubuntu Server 14.04 64-bit
- App Server: Gunicorn/Nginx
- Python: 2.7
- Ansible
- Docker 1.10
- Wordpress official Docker image https://hub.docker.com/_/wordpress/

In developing the solution, use GitHub/BitBucket and try to keep a decent history of how you approached the project.

Deliverables:
(1) A GitHub repo with the Terraform configuration, Ansible playbook, Dockerfile, shell script(s) etc.
(2) A bash script that will:
- Launch the AWS infrastructure with EC2 servers.
- Begin the configuration management / bootstrapping of the server using Ansible.
- Finally start the blogging app as a Docker process.
DO NOT CHECK THIS INTO GITHUB WITH AWS KEYS.

Remember to use security groups to restrict port access. Prefix all of your AWS resources (when possible) with your first name (example: firstname-lastname.domain.com).

We should be able to perform the following commands and then interact with a functioning app in the browser.
cloud-automation.sh <app> <environment> <num_servers> <server_size>
ex: cloud-automation.sh hello_world dev 2 t1.micro
This should return the IP address of the load-balanced Wordpress application, after which, We can open a browser to http://33.33.33.10 and see the blog app come up!

test in python for devops

Web application

Write a web application to accept the following and create, delete or modify a user with the same on a linux machine:

    1. username

    2. Shell type

    3. Home folder

    4. Password 

    5. Grant sudo privileges to the user or not.

    6. Select between create, delete and modify.

The application has to be written in Python using the flask web framework. The application will need to run as a specified user (The user will have sudo privileges). The application will need to validate the input, verify that the username provided can indeed be created, and go ahead with the specified operation that has been input.

 

Shell script

 

Given a file of the form (you can use /etc/passwd):

root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh

Write a bash 4.0 shell script that does not use any external commands that will sum the third field, delimited by ':'. Your script should take the name of the file to process as the first command line argument.

powershell



Powershell


ls , cd .. , mkdir folder , get-host


upgrade windos management framework 4.0


ls and dir is alias for get-childitem 
its a cmdlet


 


the cmdlet is always has verb-singularnoun


get-service


get-process  or ps


get-command  will list all the
command of cmdlet


 


To list all the builtin aliases


get-alias


 


copy one folder to another :


copy-item  C:\test1  C:\test2 –recurse


copy-item C:\test1,'C:\program files' C:\tset2


 


To get all the options for help for each cmdlet


Get-help copy-item   ( it may ask you
to update the help )


(  Update-help   -> to update your  help file )


Get-help  copy-item   –full


 


Suppose you want to search for a specific  command 
 ( in linux we use grep)


Get-command "services"


Get-command –Name *service*    à will give you only services .

nginx links

ansible links



============== ansible links  =====================














Other Articles

Enter your email address: