Linux Containers & Docker

Download Linux Containers & Docker

Post on 26-Jan-2015




2 download

Embed Size (px)


Slides for a quick introduction to Linux containers (lxc) and Docker from a hands-on talk given at the Johannesburg Linux User Group on the 20th Jan 2014


  • 1. Introduction to Linux Containers & Docker Jozi Linux User Group Jan 2014

2. Introduction to Linux Containers Makes use of: Namespaces: User Network Hostname Filesystem Process tableCgroups for resource limitsSeccomp filtering of system callsAppArmour/SELinuxLike chroot environment, only more secure and more full featured 3. Introduction to Linux Containers Benefits Near native performance,Application isolation, Dynamic control of resource allocation, change during run time and resources only allocated as usedLimitations All use hosts kernel, 4. Introduction to Linux Containers apt-get install lxclxc-create -t ubuntu -n Templates available - /usr/share/lxc/templates/ Default user/password: ubuntu/ubuntu Backing store - /var/lib/lxcStart a container lxc-start -n Lxc-start -n -d To shutdown issue shutdown -h now Attach lxc-console Detach via ctrl-a q 5. Introduction to Linux Containers lxc-ps List processes running in containerlxc-ls List container running on hostlxc-netstat List routing table of containerlxc-freeze Pause a containerlxc-unfreeze - Unpause a containerlxc-shutdown Shutdown a containerlxc-destory Hard stop a containerlxc-monitor monitor the state of a containerlxc-cgroup change resources allocated to a containerlxc-clone/lxc-backup/lxc-restore . 6. Introduction to Linux Containers Light-weight virtualisation No need for additional kernel nor hypervisor/translation layerNetwork setup similar to virtualisaiton Bridged orRouted (Natted) 7. Introduction to Linux Containers Libvirt integrationCan connect via VNC,VT: tty Console (ssh,lxc-console)VT: xAutostart on startup /etc/lxc/auto 8. What is Docker Docker is an application deployment tool that uses containers,Runtime manager for containers,Allows for image repository,Pushing of incremental changes from dev,test,production 9. What is docker? Docker runs as a A daemon to manage lxc containers,A cli for creating, managing lxc containersA client to access repositories for images 10. What is docker? docker searchdocker pulldocker rundocker psdocker inspectdocker imagesdocker push 11. What is docker? docker run ping docker run -i -t base/arch /bin/bash i interactivet terminalSudo docker run -i -t mmckeen/opensuse-13.1 -p 80docker port name 8080 List local host port that has been forwared to 8080docker run -d 12. What is docker Create an account on the repo server Create a image on the repo server sudo docker login sudo docker commit $CONTAINER_ID username/container-nameUpdate your image on the repo server sudo docker push username/container-name