introducing docker
TRANSCRIPT
Agenda
● About myself● What is docker● Install Docker● Demo #1 - Hello-world● Demo #2 - Docker-2048● Best practice with Docker● Demo #3 - Jira in containter● Basic commands● Useful for start-up business
Bill Wang
● Used to be system administrator● Worked in bank, telecomm, government,
cutting-edge companies● Automation Specialist ● Scriping● Start-up with a small business ● Learn Docker since 2014
What is docker?
● Content agnostic● Hardware agnostic● Content isolation and interaction● Automation● Highly efficient● Separation of duties● Build once, run anywhere
Install Docker
● Linux● Mac OS● Windows● Installation https://docs.docker.
com/installation/
Using docker with CoreOS
● Docker build-in ● Pre-configured with popular tools for running
Linux containers.● Boot extremely fast● Can be used in production environment
Install CoreOS in Vagrant
● git clone https://github.com/coreos/coreos-vagrant.git
● vagrant status● vagrant up● vagrant ssh● docker info
Demo #1 - Hello-world
● docker run --rm hello-world● docker image● docker ps -a
Demo #2 - Docker-2048
● docker run -d -p 8080:80 alexwhen/docker-2048
● Access the game http://172.17.8.101:8080/● docker history alexwhen/docker-2048● docker ps -a● docker inspect alexwhen/docker-2048● docker build -t 2048 .
Demo #2 - Build your own image
https://github.com/alexwhen/docker-2048/blob/master/DockerfileFROM alpine:latestMAINTAINER alex <[email protected]>RUN apk --update add nginxCOPY 2048 /usr/share/nginx/htmlEXPOSE 80CMD ["nginx", "-g", "daemon off;"]
Best practice with Docker
● All services in one container - WRONG● mysql, php, apache, java in each container.● Not too complex in one Dockerfile● One container provides one service● Best to limit in 3 layers - base (ubuntu, centos, java, etc)- middleware (php, node.js, mysql, etc)- own data
Demo #3 - Jira in Containers - plan
● Jira (java + database)● looking for exist docker images https://registry.hub.docker.com/u/blacklabelops/jira/
● PostgreSQL container● Jira container ● Link the database container to jira container● Troubleshooting will be easier.
Dome #3 - database container - postgresql
● docker run --name postgresql -d \ -e 'PSQL_TRUST_LOCALNET=true' \ -e 'DB_USER=jiradb' \ -e 'DB_PASS=jellyfish' \ -e 'DB_NAME=jiradb' \ -p 5432:5432 \ sameersbn/postgresql:9.4-1
Demo #3 - jira container● docker run -d --name jira \
-e "DATABASE_URL=postgresql://jiradb@postgresql/jiradb" \ -e "DB_PASSWORD=jellyfish" \ --link postgresql:postgresql \ -p 8100:8080 blacklabelops/jira
● Access jira via http://172.17.8.101:8100/
Basic commands● Dockerfile● docker image● docker build● docker ps -a● docker run● docker start/stop● docker inspect
Useful for start-up business
● simple and easy● save time and initial investment● efficient and automation● focus on coding and business, not the IT
environment setup● big support from Cloud companies, famous
IT companies and open source community
Question
Reference
● https://www.docker.com/● http://training.docker.com/● https://www.vagrantup.com/● http://boot2docker.io/