国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > 建站經(jīng)驗(yàn) > 正文

Docker Base Image自己創(chuàng)建具體實(shí)現(xiàn)

2019-11-02 16:23:34
字體:
供稿:網(wǎng)友

Docker Base Image 創(chuàng)建

            本著學(xué)習(xí)的態(tài)度,想了解創(chuàng)建 Docker Base Image的方法,在官網(wǎng),在百度,在相關(guān)論壇,查找相關(guān)資料,這里記錄下實(shí)現(xiàn)的步驟,

一. 環(huán)境

宿主機(jī)操作系統(tǒng): OS X  ,需要安裝VirtualBox  ;

容器環(huán)境:centos7

二. 用VirtualBox 安裝系統(tǒng),這里以centos 7為例(CentOS-7-x86_64-Minimal-1503-01.iso)

創(chuàng)建虛擬機(jī),并安裝centos7,以下記錄了詳細(xì)安裝過程。

* 安裝過程簡單,我這里網(wǎng)速太慢了,就不上圖了,有需要的朋友留個郵箱,我發(fā)pdf。*

安裝完后,重啟后進(jìn)入系統(tǒng)。

三. 修改網(wǎng)絡(luò)配置

修改網(wǎng)絡(luò)配置 /etc/sysconfig/network-script/ifcfg-enp0s3。刪除 UUID,HWADDR ;修改ONBOOT=no 為 ONBOOT=yes , 然后保存 。$ ifconfig Cannot find a valid baseurl for repo: base/7/x86_6重啟網(wǎng)絡(luò)接口:[root@centos7 ~]#ifdown enps03[root@centos7 ~]#ifup enps03$ yum install ifconfig  提示:Nothing to do 通過” yum provides” 命令列出那個包提供ifconfig命令$ yum provides ifconfig  // 安裝$ yum -y install net-tools

四. 安裝Docker

安裝 EPEL (參考:http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/ )[root@centos7 ~]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm修改/etc/yum.repos.d/CentOS-Base.repo 把enabled=0 改成enabled=1vim /etc/yum.repos.d/CentOS-Base.repo[centosplus]enabled=1安裝 Docker[root@centos7 yum.repos.d]# yum install docker-io啟動 Docker [root@centos7 yum.repos.d]# service docker start

五. 創(chuàng)建基礎(chǔ)鏡像

替換變量把 /etc/yum.repos.d/CentOS-Base.repo 文件中$releasever 替換成 7$basearch 替換成 x86_64快速替換方法:vim /etc/yum.repos.d/CentOS-Base.repo:%s/$releasever/7/g:%s/$basearch/x86_64/g創(chuàng)建Docker image 生成腳本[root@centos7 yum.repos.d]# cd /root[root@centos7 ~]# mkdir scripts[root@centos7 ~]# cd scripts/[root@centos7 scripts]# vim createimage.sh然后把 https://github.com/docker/docker/blob/master/contrib/mkimage-yum.sh 文件中內(nèi)容粘貼進(jìn)去[root@centos7 scripts]# chmod +x createimage.sh創(chuàng)建image[root@centos7 scripts]# ./createimage.sh centos7base創(chuàng)建成功后查看,并把當(dāng)前運(yùn)行的容器刪除掉[root@centos7 tmp]# docker imagesREPOSITORY     TAG         IMAGE ID      CREATED       VIRTUAL SIZEcentos7base     7.1.1503      112ee00c2cbc    8 minutes ago    227.7 MB[root@centos7 tmp]# docker ps -allCONTAINER ID    IMAGE         COMMAND       CREATED       STATUS           PORTS        NAMES752b9d49a079    centos7base:7.1.1503  "echo success"   10 minutes ago   Exited (0) 10 minutes ago            mad_saha[root@centos7 tmp]# docker rm 752b9d49a079752b9d49a079[root@centos7 tmp]# docker ps -allCONTAINER ID    IMAGE        COMMAND       CREATED       STATUS       PORTS        NAMES導(dǎo)出image[root@centos7 tmp]# cd /tmp/[root@centos7 tmp]# docker imagesREPOSITORY     TAG         IMAGE ID      CREATED       VIRTUAL SIZEcentos7base     7.1.1503      112ee00c2cbc    14 minutes ago   227.7 MB[root@centos7 tmp]# docker save 112ee00c2cbc > /tmp/centos7base.tar[root@centos7 tmp]# lscentos7base.tar ks-script-L8TDO5 yum.log[root@centos7 tmp]# 
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 许昌市| 东港市| 修文县| 祁东县| 铁岭县| 临沭县| 杭州市| 赤城县| 鹤峰县| 新河县| 沅江市| 庄浪县| 博野县| 元氏县| 南通市| 宜黄县| 子长县| 福海县| 错那县| 永顺县| 寻甸| 富蕴县| 阜阳市| 高清| 辰溪县| 嘉兴市| 剑川县| 搜索| 英吉沙县| 兰西县| 洛阳市| 托里县| 息烽县| 五指山市| 隆化县| 威远县| 克什克腾旗| 兴宁市| 镇康县| 新河县| 灵丘县|