iszjw 发表于 2019-2-20 12:11:08

Docker手动制作系统镜像

  docker官方和个人发布的镜像由于版本等各种原因,漏洞较多,已统计Docker Hub超过30%的官方镜像包含高危漏洞。此外,由于网络等原因也会造成docker pull下载镜像的速度很慢。基于这种情况,我们可以手动定制docker系统镜像。
  以下记录了在centos7上做docker镜像的操作记录:
  1)镜像制作脚本:mkimage-yum.sh
下载脚本地址:https://pan.baidu.com/s/1geTSQCN
提取密码:qsss
  或者直接wget
https://raw.githubusercontent.com/docker/docker/master/contrib/mkimage-yum.sh
2)执行脚本
  # chmod 755 mkimage-yum.sh
# ./mkimage-yum.sh -y /etc/yum.conf centos7
  3)脚本执行成功后,检查docker本地镜像
  # docker images
REPOSITORY          TAG               IMAGE ID            CREATED             SIZE
centos7             7.4.1708            dfb0a7b344e8      21 seconds ago      271MB
centos            latest            ff426288ea90      3 weeks ago         207MB
如上已经发现了自己制定的镜像centos7
  4)使用制定的镜像启动容器
  # docker run -i -t centos7:7.4.1708 /bin/bash
# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
提醒:制定的镜像和官方的镜像差不多干净。



页: [1]
查看完整版本: Docker手动制作系统镜像