Docker实战培训.ppt
Docker实战培训,主讲人:陈力、张振兴、魏星日期:2014-11-4TD RNC无线软件部,Docker工作流程,实战项目,Docker RegistryVirtual DesktopJenkins over Docker,Docker Registry,项目介绍 docker仓库用来保存我们的images,当我们创建了自己的image之后我们就可以使用push、pull命令从公有或者私有仓库下载、上传镜像;Docker Registry私有服务器用于保存管理我们的私有镜像。,Docker Registry,项目链接 https:/,Docker Registry,项目部署1、从docker hub上 pull镜像到本地,选择registry:,2、创建镜像目录本地镜像目录/opt/docker-image/registry本地镜像配置目录/opt/docker-image/registry-config,Docker Registry,项目部署3、本地配置文件/opt/docker-image/registry-config/config.yml,根据官网提供的config_sample.yml进行修改。(https:/)主要修改的就是本地存储的目录。,Docker Registry,项目部署4、创建Registry container,-v/opt/docker-image命令将本地的目录/opt/docker-image绑定到container的/opt目录,目的是防止container重启后数据丢失。-e DOCKER_REGISTRY_CONFIG=/opt/registry-config/config.yml设置container的环境变量。-p container到host的端口映射,Docker Registry,项目部署5、Registry container里保存的images,Docker Registry,项目部署6、从Registry container里push镜像,Docker Registry,项目部署7、从Registry container里pull镜像,Virtual Desktop,项目介绍 该项目实现的是一个基于浏览器的通过VNC服务进行访问的ubuntu桌面系统。,Virtual Desktop,项目链接 https:/,Virtual Desktop,项目部署1、从DOCKER HUB上将镜像pull到本地;,Virtual Desktop,2、创建container,Virtual Desktop,3、浏览器访问桌面系统,基于docker的TDRNC CI架构,基于docker的TDRNC CI架构,基于docker的TDRNC CI架构,基于docker的TDRNC CI架构,设计目标:虚拟化、易维护、易部署设计过程要点:1、虚拟机应可直接映射成物理机,完成jenkins的Master与Slave职责,应避免对宿主机的依赖。2、jenkins job逻辑层次在虚拟机之上,应合理部署在虚拟机上,避免出现将jenkins job等同于docker虚机逻辑层次不清的想法。3、在M-S架构设计中,应避免各Slave 虚拟机之间的相互依赖。4、以编写Dockerfile的标准方式生成image;以Fig等工具完成一键式部署,基于docker的TDRNC CI架构,Jenkins Server,vim,jenkins,ftp,ssh,.,compile,vim,ftp,ssh,code,wine,.,master,slave,基于docker的TDRNC CI架构,Jenkins Server Dockerfile,#This is jenkins on Ubuntu14.04FROM ubuntu:14.04MAINTAINER zhangzhenxingENV DEBIAN_FRONTEND noninteractiveRUN echo export http_proxy=:80/.bashrcRUN echo nameserver 10.67.1.9/etc/resolv.conf RUN echo Acquire:http:proxy http:/:80/;/etc/apt/apt.conf.#install dependanciesRUN apt-get-y build-dep pure-ftpd#build from sourceRUN mkdir/tmp/pure-ftpd/&cd/tmp/pure-ftpd/&apt-get source pure-ftpd&cd pure-ftpd-*&sed-i/optflags=/s/$/-without-capabilities/g./debian/rules&dpkg-buildpackage-b uc.ADD jdk-8u20-linux-x64.tar.gz/opt/ADD jenkins.tar.gz/tmpADD sendmail.py/tmp/ADD AllMailList.txt/tmp/ADD mail.zte/etc/,基于docker的TDRNC CI架构,.#install tclshRUN apt-get install-y-force-yes tclshRUN apt-get install-y-force-yes expect#install svnRUN apt-get install-y-force-yes subversion.ADD jdk-8u20-linux-x64.tar.gz/optADD/x86_gcc4.1.2_glibc2.5.0_V2.4P9.tar.bz2/opt/zteADD x86_64_gcc4.1.2_glibc2.5.0_V2.06.20.tar.bz2/opt/zte.#set localeRUN apt-get install-y-force-yes localesRUN echo LANG=en_US.UTF-8/etc/default/locale&echo LANGUAGE=en_US:en/etc/default/localeRUN locale-gen en_US.UTF-8WORKDIR/ENTRYPOINT/startup.sh,Compile Dockerfile,基于docker的TDRNC CI架构,master,result_proc,inc_update_Trig,dcmp compile,dcmp_daily_update,dcmp_inc_update,dcmp_compile,omp compile,omp_daily_update,omp_inc_update,omp_compile,ccmp compile,ccmp_daily_update,ccmp_inc_update,ccmp_compile,基于docker的TDRNC CI架构,