DOCKER



1) we can make a container with the required setup.


 container is nothing but the isolated environment for running the application.



Virutal machine vs container:


 Hypervisors -- we can manage virtual machine.

 dis : Each VM needs a full-blown OS

    slow to start

Resourse intensive.

 


Containers :

adv : allow multipel apps in isolation

  are lightwegiht

use OS of the host

start quickly

need less resources.



DOCKER Architecutre:

client server architecture.(REST APIs)

All the containers shares the same OS.




INSTALLING :


download from docker hub.


docker version -- both for client and server will come.







DEV WORKFLOW :


1) take application and add dockerfile to convert into docker application.

2) turns into image by docker.

3) container gets created based on the application needs.

4) we can push the image to docker registry. so that we can use the image from registry to any test/production environment.

5) Docker registry is nothing but like github for docker.


Dockerfile ex:


FROM node:alpine  (basic alphine image in linux)

COPY . /app

WORKDIR /app

CMD node /app/app.js





commands:

docker build -t hello-docker . (storing image)

docker image ls (shows image)

docker run hello-docker  (hello docker is the image to run)


docker pull codewithmosh/hello-docker (after pushing it to the registry we can pull)

docker run codewithmosh/hello-docker (to run it).



BASIC LINUX CMDs:

We need to learn LINUX to use DOCKER:


Ubuntu Linux:

docker pull ubuntu -- pull the ubuntu image in our dir

docker run -it ubuntu -- to run in interative mode

ex :  echo hello -- print hello

      whoami -- root 

echo $0 -- bin/bash 

forward slash in linux

case sensitive operating system

history 

!2 (nummber of the history cmd)


apt - package manager in linux

nano - text editer in linux


apt list - to get all the packages

apt update - upate the  packages avilable ( to refresh the packages)

apt list -- new things wil be installed

apt install nano - nano gets installed now

apt remove nano - uninstall nano


--> Everything is a file in Linux, no folder is there.

 

navigation in LINUX:

pwd - print working dir

ls - list items in the dir

      ls -l - long listing

cd -- change dir

cd .. -- one level up

cd ../.. -- two level up

ls /bin -- inside bin we can list

cd ~ --> home directory for each user

Manipulating files :

mkdir test

mv test docker -- rename or move the file

touch hello.txt -- create file

touch file1.txt file2.txt -- create multiple files

rm file1.txt -- remove the file

rm file* -- remove all the files starting with file

rm docker/ -- remove the directory itself (err: docker is a direcory)

rm -r docker/ -- remove the directory in recursion.


EDIT AND VIEW FILES:

apt install nano

nano file1.txt (to edit)

cat file1.txt (see the content of the small files)

more /etc/adduser.conf ( more easy way to read)

apt install less

less etc/userconfig.conf (less has arrows to move and also enter and space can be used)

head -n 5 /etc/adduser.conf (read first 5 lines)

tail -n 5 /etc/adduser.conf (read last 5 lines)


REDIRECTION : (change the input and output medias)


cat file1.txt > file2.txt (concadinate the file)

cat file1.txt file2.txt > combined.txt

echo hello > whatevr.txt (create and copy the file in whatever.txt)



 


 



Comments

Popular posts from this blog

Converting ids into order id in join statement.

Launching AWS hosting services.

RDBMS vs NOSQL