【玩转Docker系列7】Docker应用案例
Docker应用案例
1.1 Docker容器在线安装tcpdump
root@e7ba071cccba:/etc/apt# apt-get install tcpdump Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: apparmor The following NEW packages will be installed: tcpdump 0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded. Need to get 355 kB of archives. After this operation, 1124 kB of additional disk space will be used. Get:1 http://mirrors.163.com/ubuntu/ trusty-security/main tcpdump amd64 4.5.1-2ubuntu1.2 [355 kB] Fetched 355 kB in 0s (529 kB/s) Selecting previously unselected package tcpdump. (Reading database ... 16051 files and directories currently installed.) Preparing to unpack .../tcpdump_4.5.1-2ubuntu1.2_amd64.deb ... Unpacking tcpdump (4.5.1-2ubuntu1.2) ... Setting up tcpdump (4.5.1-2ubuntu1.2) ... root@e7ba071cccba:/etc/apt# which tcpdump /usr/sbin/tcpdump |
1.2 集成流水线使用Docker容器进行云化脚本测试
流水线云化脚本测试沙箱流程和前台IDE界面展示如下图所示:
步骤1:启动容器运行官方下载Jenkins镜像 UbuntuTest:~ # docker run -it --name myjenkins -v /var/jenkins_home jenkins Running from: /usr/share/jenkins/jenkins.war webroot: EnvVars.masterEnvVars.get("JENKINS_HOME") … … Sep 24, 2016 8:48:15 AM hudson.WebAppMain$3 run INFO: Jenkins is fully up and running UbuntuTest:~ # docker exec myjenkins ps -elf F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD 4 S jenkins 1 0 0 80 0 - 278 sigtim 09:18 ? 00:00:00 /bin/tini -- /usr/local/bin/jenkins.sh 0 S jenkins 7 1 4 80 0 - 1960703 futex_ 09:18 ? 00:00:20 java -jar /usr/share/jenkins/jenkins.war 4 R jenkins 119 0 0 80 0 - 4797 - 09:25 ? 00:00:00 ps -elf 步骤2:容器配置IP可供外部网络访问 UbuntuTest:~ # pipework briage0 myjenkins 10.71.96.199/24@10.71.96.1 UbuntuTest:~ # docker exec myjenkins ip a show eth1 57: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 26:eb:c8:9b:6d:26 brd ff:ff:ff:ff:ff:ff inet 10.71.96.199/24 scope global eth1 步骤3:浏览器中打开web界面
|
- 点赞
- 收藏
- 关注作者
评论(0)