Click here

Friday, March 23, 2018

Squid stats - Beginner's guide

Squidclient is a tool that can access the squid service, and retrieve statistics on the service. For example, to get some general performance statistic, run the following command on the squid server

Friday, March 9, 2018

Docker - Beginner's guide

1) What is docker?

A client program named Docker.

A server program that manages a Linux system[ listen for messages from the command line and manages the running system].

A program that builds container's from code

A service that distributes the containers across the internet

A company that makes containers


2) What is docker container?

Self contained sealed unit of software. Contains elements required to run the code. Includes batteries and operating system

Includes - Code, configs , processes, Networking[to allow the containers to talk to other containers],dependencies and operation system.

A container image is a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings. Available for both Linux and Windows based apps, containerized software will always run the same, regardless of the environment. Containers isolate software from its surroundings, for example differences between development and staging environments and help reduce conflicts between teams running different software on the same infrastructure.


3) What is docker engine?

"Docker engine" is the part of Docker which creates and runs Docker containers.

Because the Docker Engine daemon uses Linux-specific kernel features, you can’t run Docker Engine natively on Windows. Instead, you must use the Docker Machine command, docker-machine, to create and attach to a small Linux VM on your machine. This VM hosts Docker Engine for you on your Windows system

Basics
A Docker container is a live running instance of a Docker image.
A Docker image is a file you have created to run a specific service or program in a particular OS.So, for example, say I want a web proxy; I can create a Docker image which is a standard install of Ubuntu 14.04 with just the squid3 package installed, and some specific configuration that I want to enforce authentication to be used with that squid proxy. I've created the docker image, but it's just a file.To use it, I need to create a Docker container which uses that file to become a live running squid VM with the config of my choice.

"Docker engine" (or just "Docker") is the program which creates and runs the Docker container from the Docker image file

Basic docker commands


  1. docker run -ti debian bash[  start an debian image with bash prompt]
-i, --interactive Keep STDIN open even if not attached

-t allocate a Pseudo TTY
-ti - terminal interactive which causes it have a full  terminal within the image so that you can run the shell and get things like tab completion and formatting to work completely

  1. docker images [ shows images]

docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
debian              latest              1b3ec9d977fb        3 weeks ago         100MB
hello-world         latest              f2a91732366c        3 months ago        1.85kB

REPOSIROY - Where it came from
TAG - Version number
IMAGE ID - internal docker representation of the image


  1. docker ps - to find running containers
root@debian:/home/saravanan# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
0e512fe50c7b        debian              "bash"              14 seconds ago      Up 13 seconds                           gifted_mcclintock
  1. docker kill container-id  [ to kill the running container]
  2. Docker container ID and Image ID's are different
  3. docker ps -l = to display last stopped container

droot@debian:/home/saravanan# docker ps -l
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                       PORTS               NAMES
910bce8bfc26        debian              "bash"              9 minutes ago       Exited (127) 2 seconds ago                       elastic_curran

Status shows the exit status of the container

7. docker  ps -a ,  to display all the container's including stopped containers.  Suppose if you create a file and exited that container, it is called stopped container. The file created in that container will never get deleted . It's there in   a stopped container. If we execute a docker run command from an image , it will spawn a new instance of an image and it does not contain the file which was created in  another instance of an image.

8. Docker image ====>[ docker run] =====> Running container ==[exit]==> Stopped container=== [docker commit] =======> New image

9. docker commit container-id

To modify and save a container as an image

root@debian:/home/saravanan# docker  run -ti debian bash

root@70f0efed3d3f:/# ls 
bin  boot  dev        etc  home  lib        lib64  media  mnt  opt        proc  root  run  sbin  srv  sys  tmp  usr  var
root@70f0efed3d3f:/# touch HELLO-WORLD
root@70f0efed3d3f:/# exit
Exit

root@debian:/home/saravanan# docker ps -l , to list last exited container
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
70f0efed3d3f        debian              "bash"              15 seconds ago      Exited (0) 2 seconds ago                       competent_boyd

Method 1
root@debian:/home/saravanan# docker commit 70f0efed3d3f [ to commit a container, input -container ID]
sha256:56eaac55c9225df65d3907f56d2d0f807470bd06b4c67f6564ef7a555e339961

root@debian:/home/saravanan#

root@debian:/home/saravanan# docker tag  56eaac55c9225df65d3907f56d2d0f807470bd06b4c67f6564ef7a555e339961 my-image [ to tag an image]

Method 2
root@debian:/home/saravanan# docker ps -l
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
70f0efed3d3f        debian              "bash"              15 seconds ago      Exited (0) 2 seconds ago                       competent_boyd


root@debian:/home/saravanan# docker ps -l
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                        PORTS               NAMES
0355fd7bcf33        my-image            "bash"              4 minutes ago       Exited (127) 10 seconds ago                       heuristic_ptolemy

root@debian:/home/saravanan# docker commit competent_boyd my-image2  [ commit and tag an image, Input - container name and tag name]
sha256:496ecb935c3c72ec79381f5c89d7a4b48a9b409ddeab4ad6e1059e8862eaf444

root@debian:/home/saravanan# docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
my-image2           latest              496ecb935c3c        7 seconds ago       100MB
my-image            latest              56eaac55c922        7 minutes ago       100MB
debian              latest              1b3ec9d977fb        3 weeks ago         100MB
hello-world         latest              f2a91732366c        3 months ago        1.85kB
root@debian:/home/saravanan#


root@debian:/home/saravanan#
root@debian:/home/saravanan#
root@debian:/home/saravanan#
root@debian:/home/saravanan# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
my-image            latest              56eaac55c922        2 minutes ago       100MB
debian              latest              1b3ec9d977fb        3 weeks ago         100MB
hello-world         latest              f2a91732366c        3 months ago        1.85kB

root@debian:/home/saravanan#
root@debian:/home/saravanan#
root@debian:/home/saravanan# docker run -ti my-image
root@0355fd7bcf33:/# ls
HELLO-WORLD  bin  boot        dev  etc  home        lib  lib64  media  mnt        opt  proc  root  run  sbin  srv  sys  tmp  usr        var

root@0355fd7bcf33:/# 

Tuesday, March 6, 2018

Virtual box Full screen mode for debian

  1. Login as root;
  2. Update your APT database with apt-get update;
  3. Install the latest security updates with apt-get upgrade;
  4. Install required packages with apt-get install build-essential module-assistant;
  5. Configure your system for building kernel modules by running m-a prepare;
  6. Click on Install Guest Additions… from the Devices menu, then run mount /media/cdrom.
  7. Run sh /media/cdrom/VBoxLinuxAdditions.run, and follow the instructions on screen

Omicron - people gathers in crowd

Amidst omicron thread, people are gathered in crowd at markets and public places to buy their daily needs. Because of full lockdown at Sunda...