What is docker , How to setup docker, HOw to work around docker

Hello Readers,

Let me introduce with ‘Docker’.

Docker is an open source project that automates the deployment of Llinux applications  inside software containers.

 

Please go through the following commands.

Docker
setup docker on ubuntu 14.04
 apt-get -y install docker.io
      sudo apt-get -y install docker.io
      docker ps -a
      sudo docker ps -a
      docker images
      sudo docker images
      sudo docker pull ubuntu:14.04
      docker run -i -t ubuntu /bin/bash
      sudo docker run -i -t ubuntu /bin/bash
      sudo docker ps -a
      docker attach 6f
list containers and attach containers
sudo docker ps
sudo docker ps -a
sudo docker start ‘first few characters of container listed by using docker ps -a command ….suppose you have containers starts with 6ss you can givr command sudo docker start 6/6s/6ss’
sudo docker attach 6
ls /var/lib/docker/
    2  ls /var/lib/docker/aufs/mnt/6f4d668753e4170c76ac403a7def9cc32cb870b8f12111dc05db4896ea445aa8/
    3  ls /var/lib/docker/aufs/mnt/6f4d668753e4170c76ac403a7def9cc32cb870b8f12111dc05db4896ea445aa8-init/
Mount volume to put the current bas os’s file sin to docker
sudo docker run -v /home/anandprakash:/mnt -t centos:6 ls /mnt   – mount the any location of base os into continaer and fired command like ls
sudo docker run -v /home/anandprakash:/mnt -t centos:6 sh /mnt/b.sh – put the script b.sh to continaer by giving mounted volume of the location to continaer
docker image build
cat Dockerfile
FROM ubuntu:latest
MAINTAINER Anandprakash Tandale <anand.prqakash@izeltech.com>
RUN apt-get update
RUN apt-get install -y python python-pip
RUN pip install Flask
RUN touch /var/test.txt
sudo docker build -t “python_pip:dockerfile” .
sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED              VIRTUAL SIZE
python_pip          dockerfile          54cdc518afcb        About a minute ago   433.5 MB
<none>              <none>              318c589f7931        10 minutes ago       187.9 MB
centos              6                   a0f8f0620fa4        3 days ago           194.6 MB
centos              latest              2a332da70fd1        3 days ago           196.7 MB
ubuntu              latest              594b6e305389        9 days ago           122 MB
ubuntu              14.04               0e7d4a488bcc        9 days ago           187.9 MB
hello-world         latest              70caadc460d7        5 weeks ago          967 B
Docker run bulleted image-
docker run -i -t 700c0c0fb96d bash – where 700c0 is images id
docker cp
copy from docker to base os
 docker cp 2f47b5c2a366:/var/log/nginx/access.log .
docker create snapshot and use as a image
sudo docker run -i -t ubuntu:14.04 /bin/sh
Docker import/export
docker export sharp_shockley | gzip > sharp_shockley.tar.gz

 

 

Advertisements