Docker – 01-Basics

large_v-trans

Note : Docker currently  support x64 cpu platforms and we will use ubuntu server 14.04 64 bit machine

Installation

sudo apt-get install docker.io

sudo docker version

and we must create docker group for security reason

sudo groupadd docker

sudo gpasswd -a $USER docker

sudo service docker restart

Run Docker Containers

docker run busybox echo Hello

its means create the busybox container with default image and run echo Hello

also we can create ubuntu image

docker run -it ubuntu bash

we can see list of packages

dpkg -l | wc -l

we can see all the containers by this command

docker ps

Container Sample

docker run jpetazzo/clock

if you add -d it will run on backround and it gives the job id

docker run -d jpetazzo/clock

docker ps -q

it will show running container process

if you want to see just container ids

docker ps -aq

And you can see the logs

docker logs <job id>

docker logs –tail 5 <job id>

You can kill or stop this task

docker kill <job id>

docker stop  <job id>

Diffrances between kill and stop?

Kill     -> very quick

Stop ->less than kill

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s