Docker -quick run of docker

#ff0000;">Video Comming Soon

#ff0000;">Article not complete ……. comment for suggestions

Docker is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction and automation of operating-system-level virtualization on Linux, Mac OSand Windows.#cite_note-SYS-CON_Media-2">[2]

According to industry analyst firm 451 Research, “Docker is a tool that can package an application and its dependencies in a virtual container that can run on any Linux server. This helps enable flexibility and portability on where the application can run, whether on premises, public cloud, private cloud, bare metal, etc.”#cite_note-Linux-3">[3]

Lets start from installing docker engine

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum -y install docker-io
service docker start
chkconfig docker on
ps aux | grep docker

root 2149 0.3 2.1 719800 22080 pts/0 Sl 09:56 0:05 /usr/bin/docker -d

 

docker version   (check version)
docker (check avaliable options)

docker images (will show you what images you have)
docker search centos (to search images with certain name, here we use centos)
docker pull centos (this will install latest version of centos which is centos 7) (check docker hub for images)
or
you can also do
docker pull centos:centos6 (to install centos6.6 version)
docker info (information about docker)

docker inspect centos (show information of images)
docker run -i -t centos /bin/bash (-i interactive – t on our tty centos- on our centos image in /bin/bash shell)

you will see this [root@c2fe434c8b7e /]#
instead of [root@dockertest ~]#
exit (to exit)

ctrl-p +ctrl-q (exit withoout killing)
docker ps -a (to see container id )
docker images (to see image number)
docker rmi (to remove docker image, to check docker id do docker images)
docker commit -m=”change” containerid nameofnewimage (to make a new image from the container to retain changes for later)

docker rm docker ps --no-trunc -aq (to remove containers)
docker exec -ti containernumber bash (to get inside a container that is running)
” To run command without interactive shell prompt

docker run centos:centos6 /bin/echo “this is a test”

To run as a daemon
docker run -d centos:centos6 /bin/bash -c “while true; do echo Hello this is echo; sleep 1; done”

to check what docker instance is doing
docker ps (note the name at the end)
208084529c50 centos:centos6 “/bin/bash -c ‘while 4 minutes ago Up 4 minutes admiring_bohr

docker logs admiring_bohr (or 208084529c50)
(you will see Hello this is echo , lots of repetition because it is running in one seconds interval)

to stop the docker instance
docker stop admiring_bohr (or container id)

 

 

 

Refrence=  https://en.wikipedia.org/wiki/Docker_(software)

Leave a Reply