Docker - The Linux Container

  • 4,246 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • Hi everyone!
    Check out this website guys,
    http://greenycloud.com/

    You can create your own desktop in docker within container.

    Regards,
    Spark
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
4,246
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
224
Comments
1
Likes
13

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Docker: The Linux container Name: BalajiRajan Date: 29-Sep-2013 Event:http://www.meetup.com/devops-bangalore
  • 2. What is docker? Docker is a tool created by the folks at dotCloud to make using LinuX Containers (LXC) easier to use. Linux Containers are basically light weight Virtual Machines (VM). A linux container runs Unix processes with strong guarantees of isolation across servers. Your software runs repeatably everywhere because its Container includes all of its dependencies.
  • 3. LXC  Lxc is an operating system-level virtualization method for running multiple isolated Linux systems (containers) on a single control host.  Basicaly, LXC provides a way to run mini operating systems in your host operating system.
  • 4. What about VM? ● Any virtualization technologies such as KVM, Hypervisor and Xen..etc, which started by booting separate virtual systems on emulated hardware, and then new vm runs as a full fledged OS and uses isolated process spaces. ● But Docker runs with Host Operating system as its share the host process spaces.
  • 5. Docker vs VMs
  • 6. Docker Vs VMs  Size: VMs are very large which makes them impractical to store and transfer. VM: You have a container image that is 1GB in size. If you wanted to use a Full VM, you would need to have 1GB times x number of VMs you want. Docker: With LXC you can share the bulk of the 1GB. It means that If you have 1000 containers you still might only have a little over 1GB of space for the containers OS, assuming they are all running the same OS image.
  • 7. Docker Vs VMs  Resource Utilization: (CPU & RAM) VM: A full virtualized system gets it's own set of resources allocated to it, and does minimal sharing. You get more isolation, but it is much heavier and requires more resources. Docker: With LXC you get less isolation, but they are more lightweight and require less resources.
  • 8. Docker Vs VMs  Performance: VM: A full virtualized system usually takes minutes to start. Docker: LXC containers take seconds, and most times less then a second.
  • 9. Docker's Advantage  Throwable Sandboxes: Create a container in a minute to test your stuffs and tear it down.  Fine Application Delivery: Containers allow you to package just about any application. You could add the dependencies of the application in the container itself. Ex: mysql service.  Reusability: Docker makes containers reusbale.  Uniformity: Development and production Environments.
  • 10. Installing Docker * Docker is still under heavy development! Don’t recommend using it in production yet. * Right now, the officially supported distributions are: * Ubuntu Precise 12.04 (LTS) (64-bit) * Ubuntu Raring 13.04 (64 bit)
  • 11. Installing Docker Requirement: * Kernel version: greater then 3.8 and Cgroups and namespaces must be enabled. * AUFS: AUFS is included in the kernels built by the Debian and Ubuntu distributions. * LXC: Installation method * Source * compiled binary * package manager
  • 12. Installing Docker # Add the Docker repository to your apt sources list. sudo sh -c "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" # Update your sources sudo apt-get update # Install, lxc-docker sudo apt-get install lxc-docker # download the base 'ubuntu' container and run bash inside it #while setting up an interactive shell sudo docker run -i -t ubuntu /bin/bash
  • 13. Installing Docker # docker version Client version: 0.4.8 Server version: 0.4.8 # docker info Containers: 0 Images: 0 WARNING: No memory limit support WARNING: No swap limit support
  • 14. Terminalogy * Image An image is a read only layer used to build a container. They do not change. * Container Is basically a self contained runtime environment that is built using one or more images. You can commit your changes to a container and create an image. * Docker index / registry These are public or private servers where people can upload their repositories so they can easily share what they made.
  • 15. Creating container balaji@devops$ docker run -i -t ubuntu:12.04 /bin/bash $ cat /etc/issue Ubuntu 12.04 n $
  • 16. Lets see what docker is doing here. 1. Downloaded the image from docker repo. 2. Generated a new LXC container. 3. Created a new file system. 4. Mounted a read/write layer. 5. Allocated network interface. 6. Setup IP. 7. Setup NATing. 8 Executed the bash shell in the container. *****All in under a very few minutes *********
  • 17. Work with CLI: * List Images: $ docker images REPOSITORY TAG ID CREATED SIZE base latest b750fe79269d 3 months ago 24.65 kB (virtual 180.1 MB) base ubuntu-12.10 b750fe79269d 3 months ago 24.65 kB (virtual 180.1 MB) base ubuntu-quantal b750fe79269d 3 months ago 24.65 kB (virtual 180.1 MB) base ubuntu-quantl b750fe79269d 3 months ago 24.65 kB (virtual 180.1 MB) *List Containers: $ docker ps -a ID IMAGE COMMAND CREATED STATUS PORTS 861361e27501 base:latest /bin/echo hello world 1 minutes ago Exit 0
  • 18. Docker Index/registry The Docker Registry is server that stores all of the images and repositories. The Index just has the metadata about the images, repositories and the user accounts, but all of the images and repositories are stored in the Docker Registry. $ docker login Username (): myusername Password: Email (): myusername@example.com Login Succeeded
  • 19. Work with CLI: Important commands: * docker run base /bin/echo hello world * docker commit <id> * docker attach <id> * docker pull / push <id> * docker inspect <id> * docker diff <id> * docker stop/start <id> * docker rmi `docker images -a -q` - remove images * docker rm `docker ps -a -q` - remove container
  • 20. More Projects are coming on the way... ● http://blog.docker.io/2013/07/docker-projects-from-the-docker-co Important Projects: * Building Docker on Openstack with Vagrant * DockerUI – Web interface * Openstack-Docker * chef-docker - Installs/Configures Docker * Puppet module for installing Docker * dockermix – A command line tool to build and manage multi-container docker environments ●
  • 21. References: 1. docker.io 2. https://github.com/dotcloud/docker 3. http://kencochrane.net/blog/