通過修改然后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
大功告成!

轉載于:https://www.cnblogs.com/Micang/p/docker.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/280790.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/280790.shtml
英文地址,請注明出處:http://en.pswp.cn/news/280790.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

hdu6103[尺取法] 2017多校6

/*hdu6103[尺取法] 2017多校6*/ #include <bits/stdc.h> using namespace std; int T, m; char str[20005]; void solve() {int ans 0;int n strlen(str);for (int i 0; i < n; i) {int l 0, r 0, p1 i, p2 i 1, cost 0;while (p1 - r > 0 && p2 …

藍牙追蹤_如何使用藍牙追蹤器跟蹤您的東西

藍牙追蹤We’ve all done it: you misplace something important and you spend a lot of time (with a lot of stress) backtracking to locate it again. With Bluetooth tracking devices you can make the hunt a lot easier, less stressful, and even avoid losing the t…

遠程訪問CENTOS的MYSQL數據庫設置

遠程訪問CENTOS的MYSQL數據庫設置 mysql -u root grant all privileges on *.* to root%identified by root; 后面的root是root用戶的密碼 grant all privileges on *.* to rootlocalhostidentified by root; mysql -u root -p

ShardingCore 7.0 版本發布

NCC ShardingCore 是一款 EntityFramework Core based 高性能、輕量級、分表分庫、讀寫分離解決方案&#xff0c;具有零依賴、零學習成本、零業務代碼入侵等特點。ShardingCore 7.0 已于近期發布。從 ShardingCore 7.0 開始&#xff0c;啟用版本號第二位來對應不同的 EFCore 版…

搬運 centos7.2 apache 綁定二級目錄 訪問依然是apache頁面

<VirtualHost *:80>ServerName xx.comDocumentRoot /var/www/html/xx</VirtualHost> 轉載于:https://www.cnblogs.com/kiimi/p/8662490.html

django09: ORM以及CSRF(舊筆記)

ORM相當于程序里的數據庫操作 ORM(一) https://www.cnblogs.com/liwenzhou/p/8688919.html ORM(二) https://www.cnblogs.com/liwenzhou/p/8660826.html CSRF:防止網站請求偽造&#xff0c;即釣魚網 在Form表達添加&#xff1a;{% csrf_toker %}

vba發送郵件 簽名_如何更改“從Windows 10的郵件發送”簽名

vba發送郵件 簽名The Windows 10 Mail app is a decent email client that allows you to add other email accounts in addition to your Microsoft accounts. You’ll notice, though, that any emails you write in the Mail app have a default signature. Windows 10 Mail…

JAVA_SE基礎——24.面向對象的內存分析

黑馬程序猿入學blog ... 接著上一章的代碼&#xff1a; //車類 class Car{//事物的公共屬性使用成員變量描寫敘述。String name; //名字的屬性 String color; //顏色屬性 int wheel; //輪子數 //事物的公共行為使用函數描寫敘述。 public void run(){ System.out.println(name&…

煮茶社區AVR開發板第二版[轉]

原圖:http://blossom.cnblogs.com/gallery/image/21891.html

[Kogel.Subscribe.Mssql]SQL Server增量訂閱,數據庫變更監聽

此框架是SQL Server增量訂閱&#xff0c;用來監聽增刪改數據庫數據變更目前僅支持SQL Server&#xff0c;后續會支持MySQL和Oracle&#xff0c;Nuget上可以下載安裝或者使用Nuget命令添加包dotnet add package Kogel.Subscribe.Mssql --version 0.0.0.1可以用來處理DB主從同步&…

java instanceof運算符

instanceof 運算符 該運算符用于操作對象實例&#xff0c;檢查該對象是否是一個特定類型&#xff08;類類型或接口類型&#xff09;。 instanceof運算符使用格式如下&#xff1a; ( Object reference variable ) instanceof (class/interface type) 如果運算符左側變量所指的對…

C# XML添加刪除/SelectNodes/xpath

SelectNodes中的XPath //從當前節點的兒子節點中選擇名稱為 item 的節點。 SelectNodes("item")//從根節點的兒子節點中選擇名稱為 item 的節點。 SelectNodes("/item")// 從任意位置的節點上選擇名稱為 item 的節點。要重點突出這個任意位置&#xff0c;…

Python中*args 和**kwargs的用法

http://blog.csdn.net/chenjinyu_tang/article/details/8136841 好久沒有學習python了&#xff0c;應為工作的需要&#xff0c;再次拾起python&#xff0c;喚起記憶。 當函數的參數不確定時&#xff0c;可以使用*args 和**kwargs&#xff0c;*args 沒有key值&#xff0c;**kwar…

MFC載入JPG圖片

## 1.定義畫圖函數 HRESULT CIPCamDlg::draw(char *lpImageFile, HWND hWnd, int nScrWidth, int nScrHeight) {HDC hDC_Temp::GetDC(hWnd);IPicture *pPic; IStream *pStm;BOOL bResult;HANDLE hFileNULL; DWORD dwFileSize,dwByteRead;hFileCreateFile(lpImageFile,GENERIC_R…

DLR 的擴展庫 Dynamitey

.NET 在 CLR 對動態語言或者腳本語言的支持是通過DLR 完成的&#xff0c; Miguel de Icaza對 DLR 的特點概括如下&#xff1a;一個針對動態語言的共享式類型系統&#xff1b;一個共享的 AST&#xff0c;可以被語言開發人員用來創建新的動態語言&#xff1b;針對編譯器開發人員的…

MFC 單選按鈕Radio使用注意

使用MFC Radio時遇到問題&#xff1a;數據交換時出現斷言崩潰框 定位于&#xff1a; 解決方法&#xff1a; 1、按CTRLD&#xff0c;保證同一組內的radio的tab序號是連續的&#xff1b; 2、同一組內&#xff0c;設置 radio1的屬性&#xff1a; group、tabstop、auto均為true&am…

C# 字符串操作:split、substring、Format

1.split split可以使用多個字符切割。 "test[12]"切割后是3個字符串&#xff0c;最后一個為空。 string testString "test[12]";string[] testData testString.Split([,]);int testLength testData.Length;Console.WriteLine(testLength.ToString());…

flac格式轉換mp3格式_MP3,FLAC和其他音頻格式之間有什么區別?

flac格式轉換mp3格式Digital audio has been around a very long time so there’s bound to be a plethora of audio formats out there. Here are some of the more common ones, what differentiates them, and what to use them for. 數字音頻已經存在了很長時間&#xff…

Kubernetes:Flomesh 服務網格與多集群通信

Kubernetes 成功普及了容器集群的概念。許多用戶已經在多個集群中部署應用&#xff0c;組織需要運行多個 Kubernetes 集群可能來自以下原因&#xff08;并非詳盡列表&#xff09;&#xff1a;? 位置? 延遲&#xff08;盡可能在靠近客戶的地方運行應用程序&#xff09;? 管轄…

Java四種線程池的使用

FixedThreadPool 由Executors的newFixedThreadPool方法創建。它是一種線程數量固定的線程池&#xff0c;當線程處于空閑狀態時&#xff0c;他們并不會被回收&#xff0c;除非線程池被關閉。當所有的線程都處于活動狀態時&#xff0c;新的任務都會處于等待狀態&#xff0c;直到有…