dcoker镜像的分层
镜像分层的好处:复用节省磁盘空间,相同的内容只需加载一份到内存
修改dockerfile之后,再次构建速度加快

docker优化:
1.尽可能地选择体积小的linux发行版,比如alpine
2.尽可能合并RUN指令,清理无用文件(yum缓存,源码包)
3.修改dockerfile,把变化的内容尽可能放在dockerfile结尾。
4.使用dockerignore,减少不必要的文件ADD /html
示例:可道云
[root@docker01 kod]# cat dockerfile
###############
FROM centos:6.9
RUN curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo && \
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo && \
yum install nginx php-fpm php-gd php-mbstring unzip -y && \
yum clean all
ADD www.conf /etc/php-fpm.d/www.conf
ADD default.conf /etc/nginx/conf.d/default.conf
RUN mkdir /html
WORKDIR /html
RUN curl -o kod.zip http://192.168.37.200/191127/kodexplorer4.40.zip && \
unzip kod.zip && \
rm -rf kod.zip && \
chown -R nginx:nginx .
ADD init.sh /init.sh
EXPOSE 80
VOLUME /html
CMD ["/bin/bash","/init.sh"]
##############
构建为镜像
docker build -t kod:v3 --network=host .
查看镜像大小
docker image kod
dcoker镜像的分层的更多相关文章
- docker学习系列(三):docker镜像的分层结构
docker的镜像分层 docker里的镜像绝大部分都是在别的镜像的基础上去进行创建的,也就是使用镜像的分层结构. 实验 比如说使用dockerfile去创建一个最简单的hello镜像.创建好对应的d ...
- Docker:dockerfile镜像的分层 [九]
一.docker镜像的分层 1.图像呈现 2.命令呈现 [root@oldboy kod]# docker image history kod:v1 IMAGE CREATED CREATED BY ...
- docker镜像的分层结构三
docker的镜像分层 docker里的镜像绝大部分都是在别的镜像的基础上去进行创建的,也就是使用镜像的分层结构. 实验 比如说使用dockerfile去创建一个最简单的hello镜像.创建好对应的d ...
- Dockerfile 自动制作 Docker 镜像(三)—— 镜像的分层与 Dockerfile 的优化
Dockerfile 自动制作 Docker 镜像(三)-- 镜像的分层与 Dockerfile 的优化 前言 a. 本文主要为 Docker的视频教程 笔记. b. 环境为 CentOS 7.0 云 ...
- docker基础_docker镜像与分层
docker镜像与分层 docker镜像由一些松耦合的制度镜像层组成 docker负责堆叠这些镜像层并将它们表示为单个统一的对象 当 docker image pull ubuntu:latest 时 ...
- Dcoker镜像管理与容器应用
Dcoker镜像管理与容器应用 docker基于镜像创建容器 相同版本的镜像只允许存在一个 同一个镜像可以创建多个容器 镜像管理 [root@localhost ~]# docker pull cen ...
- Docker(四)-Dcoker镜像
Docker 运行容器前需要本地存在对应的镜像,如果镜像不存在本地, Docker 会从镜像仓库下载(默认是Docker Hub公共注册服务器中的仓库). Docker Hub:https://hub ...
- Docker系统四:Dcoker的镜像管理
1. Dcoker镜像初识 $ docker images -a //查看当前所有镜像 REPOSITORY TAG IMAGE ID CREATED SIZE cptactionhank/atlas ...
- Docker中的镜像分层技术详解
早在集装箱没有出现的时候,码头上还有许多搬运的工人在搬运货物,在集装箱出现以后,码头上看到更多的不是工人,而且集装箱的搬运模式更加单一,更加高效,还有其他的好处,比如:货物多打包在集装箱里面,可以防止 ...
随机推荐
- 我的WordPress站点
读取VDI文件 SSL和TLS Windows下使用vim的最佳方案:Sublime gdb用法 VMware的Guest与Host进行通信的三种方式 加密与解密 漫谈保护模式 processing学 ...
- python 装饰器 第十步:装饰器来装饰器一个类
第十步:装饰器来装饰一个类 def kuozhan(cls): print(cls) #声明一个类并且返回 def newHuman(): # 扩展类的功能1 cls.cloth = '漂亮的小裙子' ...
- VB - 错误处理
1.最常见的错误是运行时错误,也就是说错误在脚本正在运行的时候发生,是脚本试图进行非法操作的结果.例如零被作为除数.在vbs中,任何运行时错误都是致命的,此时,脚本将停止运行,并在屏幕上显示一个错误消 ...
- 关于<a></a>标签里嵌套<a></a>标签的bug
当你用一个<a></a>标签时,在<a>标签中再插入一个<a></a>,此时,你会发现外面的<a>标签会重复出现,且有点混乱.找 ...
- 在tkinter中使用matplotlib
import sys import tkinter as Tk import matplotlib from numpy import arange, sin, pi from matplotlib. ...
- linux+Apache开启伪静态配置
linux+Apache伪静态配置 一.环境准备:CentOS Linux release 7.4.1708 (Core)1.配置源[root@localhost ~]#yum install -y ...
- kubernetes容器集群管理创建node节点kubeconfig文件
1.创建TLS Bootstrapping Token 2.创建kubelet kubeconfig 3.创建kube-proxy kubeconfig 安装和设置kubectl [root@mast ...
- Shell基本概述
目录 Shell01--基本概述 1. Shell课程大纲介绍 2. 什么是Shell ? 3. 什么是Shell脚本 ? 4. 为什么要学Shell编程 ? 5. 学习Shell编程需要哪些知识 ? ...
- Xfce4: 显示/隐藏 休眠/混合睡眠/挂起 按钮
可以在xfconf配置项中创建如下属性控制: xfconf-query -c xfce4-session -np '/shutdown/ShowHibernate' -t 'bool' -s 'fal ...
- 15.stop引发的数据不一致
/** * 数据不一致问题 * stop */ public class StopDemo { public static Student student = new Student(); publi ...