通过修改然后commit的方式创建自己的镜像
创建自己的镜像:通过现有的镜像来创建自己的镜像。
1、首先拉取一个镜像到本地
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu 12.04 5b117edd0b76 11 months ago 104 MB
2、进入容器
$ sudo docker run -it ubuntu:12.04 bash
$ root@7a61867cf4c5:/#
3、修改容器,这里我们安装zip包
# apt-get install zip
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package zip
需要更新,我们更新
root@7a61867cf4c5:/# apt-get update
结束后
root@7a61867cf4c5:/# apt-get install zip
修改后退出
root@7a61867cf4c5:/# exit
exit
4、保存容器到镜像
$ sudo docker commit -m 'test' -a 'zhouhai' 7a61867cf4c5 ubuntu:latest
sha256:763d1f40ca6b4a801a78b39ddeb526be44330bb65f4ef94dc9267e4f0985627c
查看镜像
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest 763d1f40ca6b 13 seconds ago 133 MB
ubuntu 12.04 5b117edd0b76 11 months ago 104 MB
5、导出新产生的镜像
$ sudo docker save -o /home/zh/ubuntu_zip.tar ubuntu:latest
6、删除新产生的镜像
$ sudo docker rmi -f ubuntu:latest
Untagged: ubuntu:latest
Deleted: sha256:763d1f40ca6b4a801a78b39ddeb526be44330bb65f4ef94dc9267e4f0985627c
Deleted: sha256:e6e720db3d4ce9b5b07f4e77e6c0608add2d83b218f2b3107800682e29be246b
查看一下
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu 12.04 5b117edd0b76 11 months ago 104 MB
7、导入刚才保存的镜像
$ sudo docker load --input /home/zh/ubuntu_zip.tar
83c5e276e2c0: Loading layer [==================================================>] 29.82 MB/29.82 MB
Loaded image: ubuntu:latest
查看一下
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest 763d1f40ca6b 16 minutes ago 133 MB
ubuntu 12.04 5b117edd0b76 11 months ago 104 MB
进入容器
$ sudo docker run -it ubuntu:latest bash
root@9d1ab685dd74:/# zip
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
Zip 3.0 (July 5th 2008). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
The default action is to add or replace zipfile entries from list, which
can include the special name - to compress standard input.
If zipfile and list are omitted, zip compresses stdin to stdout.
-f freshen: only changed files -u update: only changed or new files
-d delete entries in zipfile -m move into zipfile (delete OS files)
-r recurse into directories -j junk (don't record) directory names
-0 store only -l convert LF to CR LF (-ll CR LF to LF)
-1 compress faster -9 compress better
-q quiet operation -v verbose operation/print version info
-c add one-line comments -z add zipfile comment
-@ read names from stdin -o make zipfile as old as latest entry
-x exclude the following names -i include only the following names
-F fix zipfile (-FF try harder) -D do not add directory entries
-A adjust self-extracting exe -J junk zipfile prefix (unzipsfx)
-T test zipfile integrity -X eXclude eXtra file attributes
-y store symbolic links as the link instead of the referenced file
-e encrypt -n don't compress these suffixes
-h2 show more help
大功告成!
通过修改然后commit的方式创建自己的镜像的更多相关文章
- 创建Python数据分析的Docker镜像+Docker自定义镜像commit,Dockerfile方式解析+pull,push,rmi操作
实例解析Docker如何通过commit,Dockerfile两种方式自定义Dcoker镜像,对自定义镜像的pull,push,rmi等常用操作,通过实例创建一个Python数据分析开发环境的Dock ...
- HiveServer2 的jdbc方式创建udf的修改(add jar 最好不要使用),否则会造成异常: java.sql.SQLException: Error while processing statement: null
自从Hive0.13.0开始,使用HiveServer2 的jdbc方式创建udf的临时函数的方法由: ADD JAR ${HiveUDFJarPath} create TEMPORARY funct ...
- 使用自签名的方式创建Docker私有仓库
Docker推荐使用CA机构颁发的TLS(Transport Layer Security Protocol)证书来保护docker仓库的安全,但是我们也可以选择使用HTTP或者自签名证书的方式实现本 ...
- 11g使用非duplicate方式创建物理standby要注意的问题总结
在上篇博文中,使用了duplicate方式来创建物理standby http://blog.csdn.net/aaron8219/article/details/38434579 今天来说说在11g中 ...
- docker commit命令创建新的镜像
docker commit命令创建新的镜像 1.运行容器 2.修改容器 3.将容器保存为新容器 (1)运行容器 [root@cmdb-server docker]# docker run -ti ce ...
- VB 在Visio 2010 以编程方式创建子进程图
在2010年Visio以编程方式创建子进程图 Office 2010 https://msdn.microsoft.com/en-us/library/gg650651.aspx 简介: 学习如 ...
- dotnet core 通过修改文件头的方式隐藏控制台窗口
原文:dotnet core 通过修改文件头的方式隐藏控制台窗口 在带界面的 dotnet core 程序运行的时候就会出现一个控制台窗口,本文告诉大家使用最简单方法去隐藏控制台窗口. 最近在使用 A ...
- docker的使用---创建新的镜像(通过修改容器,个人练手理解过程记录,不推荐使用)
docker基础命令 ##列出docker客户端命令 docker docker container --help ##显示docker的版本和信息 docker --version docker v ...
- 2018-9-30-dotnet-core-通过修改文件头的方式隐藏控制台窗口
title author date CreateTime categories dotnet core 通过修改文件头的方式隐藏控制台窗口 lindexi 2018-09-30 18:36:43 +0 ...
随机推荐
- HighCharts之2D回归直线的散点
HighCharts之2D回归直线的散点 1.实例源码 ScatterLine.html: <!DOCTYPE html> <html> <head> <me ...
- JXL组件生成报表报错(一)
JXL组件生成报表 1.具体报错如下 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonami ...
- Jqurey 得到url参数 getUrlParam
Jqurey 得到url参数 getUrlParam <script type="text/javascript"> (function ($) { //扩展方法获取u ...
- Linux显示查看您拥有的仓库
Linux显示查看您拥有的仓库 youhaidong@youhaidong-ThinkPad-Edge-E545:~$ yum repolist all repolist: 0
- Xampp apache与mySQL开不了 解决办法
Xampp安装后,打开Xampp control panel. 点击Apache对应的Start,开不了.原因是系统的服务占用了80端口,所以要么结束系统服务,要么修改apache端口. 个人比较喜欢 ...
- 【BZOJ3992】序列统计(动态规划,NTT)
[BZOJ3992]序列统计(动态规划,NTT) 题面 BZOJ 题解 最裸的暴力 设\(f[i][j]\)表示前\(i\)个数,积在膜意义下是\(j\)的方案数 转移的话,每次枚举一个数,直接丢进去 ...
- CF813E Army Creation
题意 \(n\)个数\(a[i] ,q\)次询问,\(n,a[i],q<=10^5\)每次问\([l,r]\)内最多可以选多少个数,满足同一个数的出现次数不超过\(k\) 强制在线 Sol 处理 ...
- [UVa11426]最大公约数之和——极限版II
题意:给出n,求: \[\sum_{i=1}^{n-1}\sum_{j=i+1}^{n}\gcd(i,j)\] 多组数据,\(n<=4*10^6\) sol 今天心血来潮再来写一写式子 首先这里 ...
- Spring入门看这一篇就够了
前言 前面已经学习了Struts2和Hibernate框架了.接下来学习的是Spring框架...本博文主要是引入Spring框架... Spring介绍 Spring诞生: 创建Spring的目的就 ...
- webpack深入场景——开发环境和生产环境配置
以前自己写一小项目时,webpack的配置基本就是一套配置,没有考虑生产环境和开发环境的区分,最近在做一个复杂的商城项目接触到了webpack的高级配置,经过两天的研究,写出了一份目前来说比叫满意的配 ...