Docker摘要
Docker
https://www.docker.com/
消除应用的依赖矩阵。 消除硬件依赖 和 软件依赖。
Escape the app dependency matrix
Eliminate the “it works on my machine” problem once and for all. Package dependencies with your apps in Docker containers for portability and predictability during development, testing, and deployment.
和任何栈工作。
在任何地方部署微服务和传统应用, 不用任何的昂贵的重写。
将应用隔离在容器中,消灭冲突和保证安全。
Works with any stack
Deploy both microservices and traditional apps anywhere without costly rewrites. Isolate apps in containers to eliminate conflicts and enhance security.
更好的团队合作。
流水线式的合作关系从开发到运维, 更快地将功能和补丁部署到生产环境。
多产的开发者频繁发布release版本, 释放构建伟大软件的创造力。
Better team collaboration
Streamline collaboration between developers and operators and get features and fixes into production faster. Productive developers doing frequent releases unleashes creativity to build awesome software.
http://www.docker.org.cn/book/docker/what-is-docker-16.html
Docker是一个开源的引擎,可以轻松的为任何应用创建一个轻量级的、可移植的、自给自足的容器。开发者在笔记本上编译测试通过的容器可以批量地在生产环境中部署,包括VMs(虚拟机)、bare metal、OpenStack 集群和其他的基础应用平台。
Docker通常用于如下场景:
- web应用的自动化打包和发布;
- 自动化测试和持续集成、发布;
- 在服务型环境中部署和调整数据库或其他的后台应用;
- 从头编译或者扩展现有的OpenShift或Cloud Foundry平台来搭建自己的PaaS环境。
Docker入门
http://www.docker.org.cn/book/docker/docker-search-image-6.html
Docker镜像制作
commit方式
https://help.aliyun.com/document_detail/28023.html?spm=5176.doc42403.6.572.PRRKlq
1. 运行基础镜像容器
docker run -it ubuntu
然后你会发现你已经以root身份进入ubuntu
root@0bab204d8f9b:/#
你可以在这里安装你想要的软件, 比如:
apt-get install python -y
apt-get install openjdk-7-jdk
....
安装完成后, 退出
exit
2. 制作镜像
docker ps -n 1 #列出最新container
找到对应的CONTAINER ID , 如: 41570524e867
docker commit 41570524e867 myubuntu
完成后,可以使用以下命令查看是否成功。
docker images
dockerfile
本例中我们将制作一个 Ubuntu 镜像,内置python。镜像名称:myubuntu。
新建一个目录 dockerUbuntu,结构如下:
dockerUbuntu|-- Dockerfile文件 Dockerfile 的内容:
FROM ubuntu:14.04# 这里要替换 your_name 为您的名字, 和your_email 为您的EmailMAINTAINER your_name <your_email># 更新源RUN apt-get update# 清除缓存RUN apt-get autoclean# 安装pythonRUN apt-get install -y python# 启动时运行这个命令CMD ["/bin/bash"]运行以下命令,build镜像:
cd dockerUbuntu #进入 dockerUbuntu 目录docker build -t myubuntu ./ #正式build, 命名为 myubuntu
- 注意:docker 命令在ubuntu中默认需要加sudo才能运行,而在Mac/Windows中,需要从“Docker Quickstart Terminal”中启动的命令行工具中运行。
build 完成后, 运行以下命令查看:
docker images可以看到类似下面的结果:
制作docker镜像,除了Dockerfile这种方式外,还有更加直观的制作方式。
Docker命令
https://github.com/wsargent/docker-cheat-sheet#delete-stopped-containers
Delete old containers
docker ps -a | grep 'weeks ago' | awk '{print $1}' | xargs docker rm
Delete stopped containers
docker rm -v $(docker ps -a -q -f status=exited)
Delete dangling images
docker rmi $(docker images -q -f dangling=true)
Delete all images
docker rmi $(docker images -q)
运行WINDOWS APP的镜像
可运行带图形界面的 win app。
https://hub.docker.com/r/suchja/wine/
https://github.com/suchja/wine
GUI via
suchja/x11serverIf you like to see the graphical output, you first need to run a container based on suchja/x11server like this:
docker run -d --name display -e VNC_PASSWORD=newPW -p 5900:5900 suchja/x11serverNow you can start the Wine container like this:
docker run --rm -it --link display:xserver --volumes-from display suchja/wine:latest /bin/bashThe
--link display:xserverand--volumes-from displayoption is only required, if graphical output from Wine shall be shown via suchja/x11server. Otherwise these two options can be omitted. Thenwinewill show warning messages, because it is not able to display graphical output.
应用于持续集成
持续集成过程包括若干环境不一的过程, 例如代码下载、 自动化单元测试、自动化CRT测试、使用astyle进行代码风格检查, 使用sourcemonitor进行代码检查。
每个过程的依赖的工具和环境, 可以固化到docker镜像中, 为每个过程制作单一的镜像。
使用Jenkins pipeline, 将持续集成的过程串起来:
https://jenkins.io/doc/book/pipeline-as-code/
Pipeline as Code describes a set of features that allow Jenkins users to define pipelined job processes with code, stored and versioned in a source repository. These features allow Jenkins to discover, manage, and run jobs for multiple source repositories and branches — eliminating the need for manual job creation and management.
To use Pipeline as Code, projects must contain a file named
Jenkinsfilein the repository root, which contains a "Pipeline script."
Docker摘要的更多相关文章
- docker 摘要(入门版)
Docker 安装 macOS或者windows 下载boot2docker工具 CentOS yum install docker-io -y systemctl start docker dock ...
- 重启服务器后Docker容器暴露的端口外网突然访问不了!!
*:first-child { margin-top: 0 !important; } .markdown-body>*:last-child { margin-bottom: 0 !impor ...
- CentOS7.6离线安装docker
2019/10/24,docker 摘要:CentOS 7.6中离线安装docker 18.06.3以及docker-compose 1.24.1 在线安装可参照 文档 所需环境 1.CentOS 7 ...
- Docker 报错 error during connect: Get pipe/docker_engine: The system cannot find the file specified. - 摘要: 本文讲的是Docker 报错 error during connect: Get pipe/dock
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.37/version: open //./pipe/docker_ ...
- Docker到底是什么?为什么它这么火!
转载来自:http://cloud.51cto.com/art/201410/453718.htm 摘要:Docker这种新的容器技术可谓热得发烫,因为有了它,人们就有可能让数量多得多的应用程序在同样 ...
- 关于docker
摘要: 最近很多阿里内部的同学和客户私信来咨询如何学习 Docker 技术.为此,我们列了一个路线图供大家学习Docker和阿里云容器服务.这个列表包含了一些社区的优秀资料和我们的原创文章.我们会随着 ...
- 使用Docker快速部署Storm环境
Storm的部署虽然不是特别麻烦,但是在生产环境中,为了提高部署效率,方便管理维护,使用Docker来统一管理部署是一个不错的选择.下面是我开源的一个新的项目,一个配置好了storm与mono环境的D ...
- docker 源码分析 四(基于1.8.2版本),Docker镜像的获取和存储
前段时间一直忙些其他事情,docker源码分析的事情耽搁了,今天接着写,上一章了解了docker client 和 docker daemon(会启动一个http server)是C/S的结构,cli ...
- 理解Docker容器的进程管理
摘要: Docker在进程管理上有一些特殊之处,如果不注意这些细节中的魔鬼就会带来一些隐患.另外Docker鼓励"一个容器一个进程(one process per container)&qu ...
随机推荐
- C++类相关
本文打算通过一些小例子来说明几个关键的知识点. 一:成员函数相关 #include <iostream> using namespace std; class D { public: vo ...
- 牛客练习赛43 Tachibana Kanade Loves Game (简单容斥)
链接:https://ac.nowcoder.com/acm/contest/548/F来源:牛客网 题目描述 立华奏是一个天天打比赛的萌新. 省选将至,萌新立华奏深知自己没有希望进入省队,因此开始颓 ...
- Surface Pro 4 系统优化全教程及QA
甲.如何根据你的需求选择相应版本的surface1.Core M3-6Y30,Core i5-6300U,Core i7-6650U的性能差距有多大?2.HD 515,HD520,Iris 540的性 ...
- java 连接数组
一,使用Apache Commons的ArrayUtils Apache Commons类库有很多,几乎大多数的开源框架都依赖于它,Commons中的工具会节省你大部分时间,它包含一些常用的静态方法和 ...
- 【洛谷P1059 明明的随机数】
题目描述明明想在学校中请一些同学一起做一项问卷调查,为了实验的客观性,他先用计算机生成了N个1到1000之间的随机整数(N≤100),对于其中重复的数字,只保留一个,把其余相同的数去掉,不同的数对应着 ...
- ANIS与UNICODE字符格式转换:MultiByteToWideChar() 和WideCharToMultiByte() 函数
资料来自: http://blog.csdn.net/holamirai/article/details/47948745 http://www.cnblogs.com/wanghao111/arch ...
- django引入模板时,部分css文件渲染不成功失灵引入不成功
今天碰到了一件怪事,下载好的模板,在webstorm中就好好地,但是一引入到pycharm的django项目中就各种失灵,位置错乱. 检查一番,发现该设置的都设置对了啊,而且js文件和css文件还有一 ...
- Git使用全解
起步 关于版本控制 Git 简史 Git 基础 安装 Git 初次运行 Git 前的配置 获取帮助 小结 Git 基础 取得项目的 Git 仓库 记录每次更新到仓库 查看提交历史 撤消操作 远程仓库的 ...
- Mybatis项目中不使用代理写法【我】
首先 spring 配置文件中引入 数据源配置 <?xml version="1.0" encoding="UTF-8"?> <beans x ...
- 【译】6. Java反射——Getter和Setter
原文地址:http://tutorials.jenkov.com/java-reflection/getters-setters.html ============================== ...
