I am covering some of the basics here. More details can be found in the free sample of my Docker Cookbook


Containers Vs VMs

Underlying Kernel Features and Execution Driver


  • pid
  • net
  • ipc
  • mnt
  • uts
  • user


For resource limitations and accounting for container SELinux/AppArmor

Union File-System

  • AUFS
  • btrfs
  • vfs
  • Device Mapper

Docker Architecture

Basic Container Operations

  • Make sure you have setup ready, as mentioned in earlier section
$ vagrant up
$ vagrant ssh labvm-1
$ sudo -s
<<<<<<< HEAD

======= </pre> »»»> 2f550b18185ef0e4c7f0f75f94c916de5480c014

  • Start the container
docker run -it  --name centos1 centos bash
docker run -it --rm  --name centos2 centos bash
  • Start the the container in background
docker run -d  --name centos2 centos  /bin/bash -c "while [ 1 ] ; do echo LinuxConEU2015 ; sleep 1; done"
  • Looking at the logs of container
docker logs centos2
  • Listing containers
docker ps
docker ps -a
docker ps -a -q
  • Stopping a container
docker stop centos2
  • Stopping all containers
docker stop `docker ps -a -q`
  • Deleting a container
docker rm centos2
  • Deleting all containers
docker rm  -f `docker ps -a -q`
  • Injecting new process inside a running container
docker run -d  --name centos3 centos  /bin/bash -c "while [ 1 ] ; do echo LinuxConEU2015 ; sleep 1; done"
docker exec -it centos3 bash
$ ps aux
  • Inspecting a container
docker inspect centos3

Basic Image Operation

  • Pulling an image
docker images
docker search fedora
docker pull <image>
  • Creating an image from container
docker run -idt  --name busyboxC busybox /bin/sh
docker commit -a "Neependra" -m "busybox updated" busyboxC  linuxcon/mybusybox
  • Exporting an image
docker save -o  mybusybox.tar linuxcon/mybusybox
  • Deleting an image
docker rmi linuxcon/mybusybox
  • importing an image
cat mybusybox.tar | docker import - linuxconeu/mybusybox
  • Building image from Dockerfile
echo i “FROM” > Dockerfle
echo  “RUN date > ~/date” >> Dockerfile
cat Dockerfile | docker build -t centoswithdate1 -
docker images

More details about Dockerfiles can be found on [Docker Website] (