0% found this document useful (0 votes)
134 views

Docker Commands

1. The document discusses various Docker commands for creating images, containers, volumes, and port mapping. It provides examples of using commands like docker run, docker commit, docker build and docker volume to set up containers and share resources. 2. Creating images involves using docker commit to capture changes to a container as an image. Dockerfiles can also be used to automate image creation. 3. Volumes can be automatically created using Dockerfile instructions or manually specified with -v flags to persist data outside containers. Host volumes mount local filesystem paths.

Uploaded by

karim shaik
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
134 views

Docker Commands

1. The document discusses various Docker commands for creating images, containers, volumes, and port mapping. It provides examples of using commands like docker run, docker commit, docker build and docker volume to set up containers and share resources. 2. Creating images involves using docker commit to capture changes to a container as an image. Dockerfiles can also be used to automate image creation. 3. Volumes can be automatically created using Dockerfile instructions or manually specified with -v flags to persist data outside containers. Host volumes mount local filesystem paths.

Uploaded by

karim shaik
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Docker commands in telugu

→Basic process commands: - how to create images and how to crate container
 yum update -y = files ni update cheystundi
 yum install docker -y = docker install avthundi docker linux machine lo leka poty
wget tho download cheyachu
 which docker = docker
 docker -v = version check cheyali anukunte
docker --version
 service docker status = inactive lo vutundi
docker info
 service docker start = active avthundi
 docker images = images ante like ubuntu Jenkins docker (docker hub lo
emina download cheyste chupistundi)
 docker ps (process status-full form) = important command container check
cheyadaniki (start lo vuna containers
chupistundi)
 docker ps -a = hidden chupistundi (stop cheysina containers and run lo vuna
containers chupistundi)
 docker search ubuntu = docker hub nudi velakunda cmd dawra images check
cheyali anukunte linux-machine lo e cmd
 docker pull ubuntu = ubuntu image ni download cheystundi
docker pull redis____docker pull centos____docker pull jenkins_____etc
 docker run -it ubuntu /bin/bash = e command tho docker hub nudi pull cheysi
download cheystundi and container lo direct velalli anukunte cmd
 cat /etc/os-release = ani detailes chupistundi ubuntu operating system version
ani
 docker run -it ubuntu /bin/bash = again e cmd type cheyste new container ni
create cheystundi ani sarllu e cmd type cheystamo ani sarllu new container ni
create cheystundi
 docker run -it --name kareem ubuntu /bin/bash = container name evali anukunte
new container ke matrame e cmd (real time lo use cheyse cmd)
 docker run -it --name kareem ubuntu “touch f1” = e cmd tho manom name and
bin/bash name change cheyali anukunte cmd
 Container nudi bayatike ravali ante = exit type cheyste challu
Container lo vunam ani ela telustundi ante (ec2-user lo root@bg9ab9aa4df3:/ane id
chupistundi)
 docker start kareem = stop cheysina container ni start cheyali anukunte
docker attach kareem = start ayina container lopalike velali anukunte
docker stop kareem = stop cheyali anukunte cmd
 docker rm kareem = container ni delete cheyali anukunte cmd and run lo vuna
container delete avadu stop cheysi delete cheyali
 docker rmi (ID) = image ni delete cheyali anukunte command
 docker rmi -f $(docker images -q) = all images ni delete cheyali anukunte

→e process lo applications install cheysi aa applications ni chustam (scenarios lo


applications and softwares ni install cheystam) ex:- kinda file tho lab cheystam
 first container create cheyali (docker run -it --name container1 ubuntu /bin/bash)
tmp lo velli voka file create cheyali. Tarvata voka image create cheyali (docker
commit container1 ubuntu-1) ey container lo file create cheysamo dani name and
image name edina new name. and final procedure (docker run -it --name
container2 ubuntu-1 /bin/bash) edi final cmd “cd tmp” lo velli check cheyste file1
show avthundi elane same procedure repeat avthundi edina software update
cheysina check and chudali ante procedure same.

1. container create cheystom = docker run -it --name container1 ubuntu


/bin/bash (cd tmp lo velli file1 vokati create cheystam example ke)
2. image vokati create cheystom = docker commit container1 ubuntu-1
3. container vokati create cheystam new image tho = docker -it --name
container2 ubuntu-1 /bin/bash (cd tmp lo velli check cheyste file1 show
avthundi)
 docker commit container1 ubuntu-1 = image create cheyadaniki cmd (imp)
 docker diff kareem = ippati varku manom em changes cheysamo list tho
chupistundi “kareem ante container name” (cmd only exit lone work avthundi)
→image create cheyadaniki third process (deni automation ani kuda antaru)
 vim Dockerfile = docker file vokati create cheystam “docker file lo capital D ne
 evali
script rayali :-
FROM ubuntu
RUN echo “this is kareem shaik” > /tmp/testfile
tmp directory lo testfile create avthundi andulo this is kareem shaik content show
avthundi
 docker build -t test . = -t anadi tag evadaniki test anadi image name edina evachu
example nenu test teskona
 docker run -it --name kareem test /bin/bash = new container create cheystam
tarvata tmp lo velli check cheyste
testfile perutho voka file vutundi.

Second Script :-
FROM ubuntu
WORKDIR /tmp
RUN echo “this is kareem file” > /tmp/testfile1
ENV name kareem
COPY file1 /tmp
ADD test.tar.gz /tmp
Copy ke voka file create cheystom “touch file1” appudu e copy sample kuda work
avthhundi. Kani add sample ke china process vundi kavali ante youtube chudali.
edi second script anadi first script ni erase cheysi type cheyali ‘Dockerfile’ lo inka
samples google cheyste dorukutai
Dockerfile__________image__________container (e three steps cheystam)

 dockerfile components :-
1. FROM :for base image this command must be on top of the file.
2. RUN :to execute commands, it will create a layer in file.
3. Copy :copy files from local system.
4. ADD :it can download files from internet and also. We can extract file at
docker image side.
5. EXOPSE :to expose ports such as 8080 for tomcat and port 80 for nginx etc.
6. WORKDIR :to set working directory for the container.
7. ENV :environment variables.

→Docker volume creation process are two types


1. Auto machine 2. Manual 3. Host volume – (local files ni container lo save
cheyali anukunty)

1. Auto machine
 vim Dockerfile = docker file vokati create cheystam “docker file lo capital D ne
evali”

script rayali :-
FROM ubuntu
VOLUME [“/kareem”]
RUN touch file1

 docker build -t image1 . = image ni build cheystam (. Ante present directory ani
ardham)
 docker run -it --name container1 image1 /bin/bash = container create cheystom
ls = ani esty file1 and kareem volume chupistundi container lo
kareem volume lo velli edina files create cheystom
→(container1 lo vuna volume ni vere container ke share cheyali anukunte process):-
 docker run -it --name container2 --privileged=true --volumes-from container1
image1 /bin/bash = first new container name evali and volumes-from lo manom
first create cheysina volume container name and image name evali
and “cd kareem” volume lo veli check cheyste files chupistundi. Manom container2
volume lo edina changes cheyste adi container1 lo vuna volume lo kuda reflect avthundi

2. Manual
 Docker run -it --name container3 -v /kareem-1 image1 /bin/bash = new container
name evali “container3” and new volume name “kareem-1” and manom create
cheysina image name evali “image1”anadi manom already create cheysindi evali
ls = ani iche check cheyste manaki volume chupistundi “kareem-1” tarvata voka file
create cheystom
→(container3 lo vuna volume ni vere container ke share cheyali anukunte manual
Process lo):-
 Docker run -it --name container4 --privileged=true --volumes-from conatiner3
image1 /bin/bash = vere container ke share cheyali anukunte cmd

3. Hostvolume
 Docker run -it --name hostcontainer -v /home/ec2-user:/hostvolume ubuntu
/bin/bash = local lo vuna files ni container lo save cheyali anukunte cmd. First new
container name and local files path “home/ec2-user” and volume name “ex:-
hostname” and image name “ubuntu”

Ippati varku create cheysina volumes ni list cheyali ante command


 Docker volume ls = volume list chupistundi
 Docker volume create kareem = Volume create cheyali aukunte
 docker volume rm kareem = volume ni delete cheyali anukunte command
 docker volume prune = e cmd vachi ippati varaku ye container ke attach leni
Volumes aniteni delete cheystundi

→Docker port mapping process :-


New ec2-linux machine vokati tiskuntom docker install cheysina tarvata ichey cmd’s
 docker run -td –name techserver -p 80:80 ubuntu = container create cheystom
 docker port techserver = ports ey map ayenvo chupistundi
 docker exec -it techserver /bin/bash = container lopalike velalli ante
 apt-get update = update cheystundi
 apt-get install apache2 -y = apache install cheystundi
 cd /var/www/html = default directory lopalike veltham
 echo “subscribe channel” >index.html = save chheystom
 servce apache2 start = server ni start cheydaniki cmd (public---ip) internet lo
Vesty ‘subscribe channel’ chupistundi

Creating a new container with jenkins


 docker run -td --name myjenkins -p 8080:8080 jenkins/Jenkins = Jenkins ni
download cheystundi (public---ip) like 35.45.35.255:8080 jenkins page
chupistundi

→docker hub tho work ela cheyalo e process lo chustom :-


 docker run -it ubuntu /bin/bash = container create cheystom
 ls = cheyste local files chupistundi. tarvata “touch file1 file2 file3 test” files create
cheyali nad “tmp lo velli touch file4 file5 file6” create cheystom
 docker commit crazy_jones image1 = image vokati create cheystom files vuna
“container name istom” new image name
Istom
 docker login = docker account user name and password istom
 docker tag image1 kareem99/project1 = create cheysina name “image1” and
account name and name project1 ani icheyam
 docker push kareem99/project1 = push avthundi (edi public image)

and another ec2-instance create cheystom region vachi virginia teskunom (docker install
cheysi start cheyali)
 docker pull kareem/project1 = pull cheyadaniki command (image chupiistundi)
 docker run -it --name container1 kareem/project1 /bin/bash = container ni crea
te chaistom (ls cheyste files ani chupistundi)
na image ni private kuda cheyachu and image ni mala acces cheyali ante login
ayi pull cmd type cheyste work avthundi

THE END

You might also like