command
to check the full container id
1) docker ps --no-trunc
2) docker run -d --name nginx ( -d is used to run in the background)
3) docker ps -a ( command to check the all docker image command will show all the images not running )
4) docker run -ti --name b2 busybox ( ti means Terminal interactive)
5) ps aux
6) deattach the container
6.1) docker run -ti name b3 busybox
6.2) ps aux; top
CTRL + P + Q detach from the terminal will run from the background
docker attach b3 .
7.0) command to run the command inside the container
docker exec
7.1) docker run -d --name ngnx2 nginx
7.2) docker exec ngnx2 ip a s
7.3) docker exec -ti nginx2 /bin/bash
7.4) ps aux
8.0) docker run --name b4 busybox ip a s will run the container and exit it
8.1) docker ps
9) docker run --name b10 -rm busybox ip a s ( the following command will run the busy box container and removed the container ) used to remove the junk dontainer
9) docker run -rm -u 500:500 busybox ( to find the user id and group id) busybox) container need uid/gid
10) proceed running in the contaier
11) docker top nginx
12) resource usage
13) docker stats nginx
14) stopping and killing container
15 ) docker stop nginx
16) docker start nginx; docker ps, default time to stop the container 10 sec
17) docker stop -t 15 nginx command to stop the container fter 15 sec.
18 to terminate the running container
docker kill Dockername
19) how to remove the container
19.1) docker rm < Docker name>
19.2) to check the container docker ps -a
19.3) docker stop; docker rm -f docker name
< >
19.4) docker rm -v docker name ( remove the docker with persistent data) be care full
19.5) Container logs
20)
20.1) docker logs < docker name>
20.2) docker logs will be stored in /var/lob docker/container
20.3) check for the container id
20.4) go to the directory
20.5) containerid-Jason.log will hold all the logs.
20.6) Config file are stored in json file.
20.7) docker logs -f
1) docker ps --no-trunc
2) docker run -d --name nginx ( -d is used to run in the background)
3) docker ps -a ( command to check the all docker image command will show all the images not running )
4) docker run -ti --name b2 busybox ( ti means Terminal interactive)
5) ps aux
6) deattach the container
6.1) docker run -ti name b3 busybox
6.2) ps aux; top
CTRL + P + Q detach from the terminal will run from the background
docker attach b3 .
7.0) command to run the command inside the container
docker exec
7.1) docker run -d --name ngnx2 nginx
7.2) docker exec ngnx2 ip a s
7.3) docker exec -ti nginx2 /bin/bash
7.4) ps aux
8.0) docker run --name b4 busybox ip a s will run the container and exit it
8.1) docker ps
9) docker run --name b10 -rm busybox ip a s ( the following command will run the busy box container and removed the container ) used to remove the junk dontainer
9) docker run -rm -u 500:500 busybox ( to find the user id and group id) busybox) container need uid/gid
10) proceed running in the contaier
11) docker top nginx
12) resource usage
13) docker stats nginx
14) stopping and killing container
15 ) docker stop nginx
16) docker start nginx; docker ps, default time to stop the container 10 sec
17) docker stop -t 15 nginx command to stop the container fter 15 sec.
18 to terminate the running container
docker kill Dockername
19) how to remove the container
19.1) docker rm < Docker name>
19.2) to check the container docker ps -a
19.3) docker stop
19.4) docker rm -v docker name ( remove the docker with persistent data) be care full
19.5) Container logs
20)
20.1) docker logs < docker name>
20.2) docker logs will be stored in /var/lob docker/container
20.3) check for the container id
20.4) go to the directory
20.5) containerid-Jason.log will hold all the logs.
20.6) Config file are stored in json file.
20.7) docker logs -f
20.8) docker run -it --name b10 busybox
20.9) Limit memory to container
22) docker run -d --name nginx3 -m 500M nginx
docker stats nginx3
22.1) docker run -d --name nginx4 nginx docker stats with out memory limit
docker stats nginx4
22.2) Memory reservation
22.4) docker run -d --name nginx5 -m 512M --memory-reservation 256M nginx
22.5) docker stats nginx5
To check the specific Docker image
1) Docker
search busybox
2) Official
image ( more stars)
3) Docker
search –s 50 busy box ( to search the minimum star)
4) Docker
pull nginx ( pull the latest version)
5) To
pull the specific image
6) Docker
pull nginix:1.9 it will download the 1.9 version nginx
7) Docker
images
8) Docker
pull –a busybox ( to pull all the layers)
9) Docker
images –a will list all the busybox images
10) Removing
the images
11) Docker rmi
busybox It will remove the latest tag
12) Docker rmi
–f busybox ( to remove the container when running ) not best method
13) Create a
new image using existing image
14) Docker run
–d –name nginx6 nginx
15) Docker
exec –ti nginix /bin/bash
16) Aptget
update
17) Docker
diff nginx 6 list all the changes in the container
18) Docker
commit –a “name of the author” –m “A message for the note” docknginix:1
To move to container
1) Save
and export
2) Docker
export nginix6 > nginix.tar ( will have only one layer)
3) Docker
export –o nginx6b.tar nginx6
4) tar
tvf tvf nginx6.tar
5) how
to import the tar archive
6) docker
import nginix6.tar nginx-own:latest
7) docker
images
8) docker
save –o nginix-save.tar nginx:latest
9) tar
tvf nginx-ta.tar | less
10) docker rmi
nginx
11) docker
load –I nginx-save.tar
12) docker
load –I nginix-save.tar
13) command to
upload the container to registry
14) #!/bin/bash
15) # Delete all containers
16) docker rm $(docker ps -a -q)
17) # Delete all images
18) docker rmi –f $(docker images -q)
No comments:
Post a Comment