为什么每次提交容器时docker映像大小都会增加?

时间:2019-08-31 08:09:59

标签: docker oracle-xe

我已经通过使用来自github的Docker文件创建了Oracle XE 11g数据库映像。该映像最初为1.33 GB。创建模式并插入数据后,容器大小约为2.5 GB。我需要在特定时间点从容器中创建图像。我不想每次都需要使用dockerfile运行所有脚本并从基础创建数据库。问题是,每次我提交容器时,即使不做任何更改(用于测试行为),泊坞窗也会添加大小为1.33的原始映像的副本,并且大小会增加。码头工人为什么这样做?是否可以防止此尺寸增加?

第一张图像具有以下几层

C:>docker history oracle-xe
IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
09dac6d187f9        About an hour ago   /bin/sh -c exec $ORACLE_BASE/$RUN_FILE2         1.33GB
84f67c51acff        3 days ago          /bin/sh -c #(nop)  CMD ["/bin/sh" "-c" "exec…   0B
<missing>           3 days ago          /bin/sh -c exec $ORACLE_BASE/$PWD_FILE          557kB
<missing>           3 days ago          /bin/sh -c exec $ORACLE_BASE/$RUN_FILE          1.32GB
<missing>           3 days ago          /bin/sh -c #(nop)  EXPOSE 1521 8080             0B
<missing>           3 days ago          /bin/sh -c yum -y install unzip libaio bc in…   700MB
<missing>           3 days ago          /bin/sh -c #(nop) COPY multi:7301521b1b0c1e6…   316MB
<missing>           7 days ago          /bin/sh -c #(nop)  ENV PATH=/u01/app/oracle/…   0B
<missing>           7 days ago          /bin/sh -c #(nop)  ENV ORACLE_BASE=/u01/app/…   0B
<missing>           7 days ago          /bin/sh -c #(nop)  MAINTAINER Gerald Venzl <…   0B
<missing>           3 weeks ago         /bin/sh -c #(nop)  CMD ["/bin/bash"]            0B
<missing>           3 weeks ago         /bin/sh -c #(nop) ADD file:ec6faaeaeb57818c0…   118MB
<missing>           12 months ago       /bin/sh -c #(nop)  MAINTAINER Oracle Linux P…   0B

在不做任何更改并提交容器之后,新图像将具有以下层:

C:>docker history oracle-xe-commit
IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
63f763341c07        19 minutes ago      /bin/sh -c exec $ORACLE_BASE/$RUN_FILE2         1.33GB
09dac6d187f9        About an hour ago   /bin/sh -c exec $ORACLE_BASE/$RUN_FILE2         1.33GB
84f67c51acff        3 days ago          /bin/sh -c #(nop)  CMD ["/bin/sh" "-c" "exec…   0B
<missing>           3 days ago          /bin/sh -c exec $ORACLE_BASE/$PWD_FILE          557kB
<missing>           3 days ago          /bin/sh -c exec $ORACLE_BASE/$RUN_FILE          1.32GB
<missing>           3 days ago          /bin/sh -c #(nop)  EXPOSE 1521 8080             0B
<missing>           3 days ago          /bin/sh -c yum -y install unzip libaio bc in…   700MB
<missing>           3 days ago          /bin/sh -c #(nop) COPY multi:7301521b1b0c1e6…   316MB
<missing>           7 days ago          /bin/sh -c #(nop)  ENV PATH=/u01/app/oracle/…   0B
<missing>           7 days ago          /bin/sh -c #(nop)  ENV ORACLE_BASE=/u01/app/…   0B
<missing>           7 days ago          /bin/sh -c #(nop)  MAINTAINER Gerald Venzl <…   0B
<missing>           3 weeks ago         /bin/sh -c #(nop)  CMD ["/bin/bash"]            0B
<missing>           3 weeks ago         /bin/sh -c #(nop) ADD file:ec6faaeaeb57818c0…   118MB
<missing>           12 months ago       /bin/sh -c #(nop)  MAINTAINER Oracle Linux P…   0B

0 个答案:

没有答案