introducing docker
DESCRIPTION
These are the slides I used in my local libre user group meetup to introduce Docker to my friends and users from varied backgrounds.TRANSCRIPT
Docker
Dec 2013
www.anubhaskar.name
Creative Commons Attribution-ShareAlike 3.0 Unported License.
2
1.Introduction2.Prototype Architecture3.Prerequisites4.Install & configure Docker5.Install & configure Docker private registry6.Register container image7.Create container in first host8.Create container in second host
AGENDA
Creative Commons Attribution-ShareAlike 3.0 Unported License.
3
Introduction
Creative Commons Attribution-ShareAlike 3.0 Unported License.
Docker is
● An Open source software
● Based on Linux container technology (LXC)
● Configure once...run anywhere approach
● Used to deploy application in a self contained lightweight and isolated Linux container
4
Prototype Architecture
Creative Commons Attribution-ShareAlike 3.0 Unported License.
dockerreg10.10.10.3/Centos
repo10.10.10.2/Centos
(centos docker imagedownloaded from Internet)
dockerhost110.10.10.4/Centos
Container1PrivateImage
Repository
dockerhost210.10.10.5/Ubuntu
Container2
5
Prerequisites
Creative Commons Attribution-ShareAlike 3.0 Unported License.
For simplicity and ease of demonstration below changes are made in prototype. These options should be avoided or carefully considered in a production deployment
1. Two hosts are installed with Centos6.3 minimal install cd.
2. Disable SELinux on two hosts# vi /etc/selinux/configSELINUX=disabled
3. Disable firewall on two hosts# chkconfig iptables off
4. Add host names# vi /etc/hosts10.10.10.2 repo10.10.10.3 dockerreg10.10.10.4 dockerhost110.10.10.5 dockerhost2
6
Prerequisites
Creative Commons Attribution-ShareAlike 3.0 Unported License.
5. Reboot server and client hosts
6. Third host is installed with Ubuntu12.04 server
7
Install & configure Docker
Creative Commons Attribution-ShareAlike 3.0 Unported License.
1. Install docker in centos hosts repo, dockerhost1
# yum install docker-io
Note: Epel repository should be enabled for docker rpm
2. Start docker service in docker-registry host
# service docker start
3. Install docker in ubuntu host dockerhost2# echo “deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list# apt-get update# apt-get install lxc-docker
8
Install & configure Docker private registry
Creative Commons Attribution-ShareAlike 3.0 Unported License.
1. Install docker's private registry software in host dockerreg
# yum install docker-registry
Note: Epel testing repository should be enabled for docker-registry rpm
2. Start docker-registry service in docker-registry host
# service redis start# service docker-registry start
9
Register container image
Creative Commons Attribution-ShareAlike 3.0 Unported License.
1. Download centos container image from central repository (index.docker.io) in host repo.
# docker pull centos
2. View the downloaded image details
# docker images
3. Upload the image to local private registry
# docker tag centos dockerreg:5000/os# docker push dockerreg:5000/os
10
Create container in first host
Creative Commons Attribution-ShareAlike 3.0 Unported License.
1. Start container in dockerhost1# docker run -i -t dockerreg:5000/os /bin/bash
2. Install Apache inside container[container]# yum install httpd[container]# service httpd start[container]# netstat -ntlp[container]# exit
3. Save the container with Apache as new image# docker ps -a# docker commit <container id from above cmd> osweb
4. Upload new image to private registry# docker tag osweb 10.10.10.3:5000/osweb# docker push 10.10.10.3:5000/osweb
11
Create container in second host
Creative Commons Attribution-ShareAlike 3.0 Unported License.
1. Start container in dockerhost2# docker run -i -t dockerreg:5000/osweb /bin/bash
12
THANK YOU
Creative Commons Attribution-ShareAlike 3.0 Unported License.