Docker Training Course - Docker Austin meetup - March 13 2014

9,444 views

Published on

Basic Docker Training

1. Basic Docker Concepts
2. Docker Terminologies
3. Docker Labs - Commands, Purpose and examples

Published in: Technology
1 Comment
38 Likes
Statistics
Notes
No Downloads
Views
Total views
9,444
On SlideShare
0
From Embeds
0
Number of Embeds
6,158
Actions
Shares
0
Downloads
257
Comments
1
Likes
38
Embeds 0
No embeds

No notes for slide

Docker Training Course - Docker Austin meetup - March 13 2014

  1. 1. Docker Training Docker Austin Meetup March 13, 2014
  2. 2. Basic concepts Docker - Not a replacement to LXC Namespaces: ● First level of isolation ● Process running in a container cannot see or affect other processes running outside the container Control Groups: ● Key Component of LXC ● Resource Accounting and Limiting are the key functions. ● Significant to multi-tenant platforms: Guarantees consistent uptime and performance
  3. 3. LXCs LXCs are lightweight . Run multiple isolated instances on the same host Share a single kernel, but can have a set definition for the number of resources they can consume. Does not allow interference among instances.
  4. 4. Docker Terminology Docker Registry: is a registry server for Docker that helps hosting and delivery of repositories and images Layer: Each file system that is stacked when Docker mounts rootfs Image: is a read-only layer that never changes Container: Self-contained environment built using one or more images. Images can be created based on the committed containers Repository: Set of images on local Docker or Registry server
  5. 5. Docker Files Dockerfiles allow describing build steps once and later build a container automatically from source Can be viewed as an image representation Helps ● Build images easily ● Automates and scripts image creation
  6. 6. Docker labs
  7. 7. Install Docker (Ubuntu 13.10) Add Docker repository to local keychain: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 Add Docker repo to apt source list, update and install lcx-docker package sudo sh -c "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" sudo apt-get update sudo apt-get install lxc-docker Verify Installation sudo docker run -i -t ubuntu /bin/bash
  8. 8. docker pull ubuntu: precise docker pull ubuntu:12.04Command: Pull Ubuntu 12.04 LTS Precise Base Image Purpose:
  9. 9. docker run Choose a mode to run the Docker container run background/ detached run run foreground run interactive 1. Container does not listen 2. IO is done through Network or sharing 1. Default Mode 2. Attaches console to the process’s stdin, stdout, stderr 1. Persistent standard input needed
  10. 10. docker run (background) -d=true: or -dCommand/ Options: Run container in the background, print new container id Purpose:
  11. 11. docker run (foreground) -d=false: Command/ Options: Start the process in the container also acts as the TTY Purpose: -a=[] : Attach to stdin, stdout and/or stderr -t=false : pseudo-tty -i=false : stdin open even if not attached Other Options:
  12. 12. docker run (interactive) use -i and -t togetherCommand/ Options:
  13. 13. docker run ssh # sshd # # VERSION 0.0.1 FROM ubuntu MAINTAINER Thatcher R. Peskens "thatcher@dotcloud.com" # make sure the package repository is up to date RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list RUN apt-get update RUN apt-get install -y openssh-server RUN mkdir /var/run/sshd RUN echo 'root:screencast' |chpasswd EXPOSE 22 CMD /usr/sbin/sshd -D Dockerfile to set up an sshd service in a container
  14. 14. docker run (port forwarding) docker run -P <imageid>Command: docker run -p [([<host_interface>: [host_port]])|(<host_port>):] <container_port>[/udp] <image> <cmd> Command: Auto-map all exposed ports to host: Binding a port to a host interface
  15. 15. docker run (volume sharing) Command: docker run -v /var/volume1 -v /var/volume2 DATA busybox true Create container with 2 volumes Mount Data volumes into application container Command: docker run -t -i -rm -volumes- from DATA -name client1 ubuntu bash
  16. 16. docker diff docker diff CONTAINERCommand: List the changes in files and directories in a container’s filesystem Purpose:
  17. 17. docker inspect docker inspect CONTAINER|IMAGE [CONTAINER|IMAGE...] Command: Return low-level information as JSON arrays Purpose:
  18. 18. docker build docker build [OPTIONS] PATH | URL | -Command: Use the source code at PATH to build a new container image Purpose:
  19. 19. docker commit docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]] Command: Use the container’s changes to create a new image Purpose:
  20. 20. docker push docker push NAMECommand: Push a container or image to the registryPurpose:

×