Skip to content
This repository has been archived by the owner on Jul 6, 2018. It is now read-only.

Reduce image size produced by machine_image resource #26

Open
marc- opened this issue Mar 5, 2015 · 1 comment
Open

Reduce image size produced by machine_image resource #26

marc- opened this issue Mar 5, 2015 · 1 comment

Comments

@marc-
Copy link
Contributor

marc- commented Mar 5, 2015

I found that docker image created by machine_image resource has too many redundant layers in it.

REPOSITORY        TAG                 IMAGE ID            VIRTUAL SIZE
chef              test                85d60acf156b        386.7 MB
ubuntu            14.04               2d24f826cb16        188.3 MB
IMAGE         CREATED BY                                                         SIZE
85d60acf156b  chef-client -l auto                                                2 B
d18b21b38ae7  dpkg -i /tmp/chef_12.1.0-1_amd64.deb                               154.4 MB
911920e7729f  /bin/sh -c #(nop) ADD file:<hash> in /tmp/chef_12.1.0-1_amd64.deb  43.96 MB
3f9ff1bb17bb  /bin/sh -c #(nop) ADD file:<hash> in /tmp/detect.sh                3.559 kB
374b13cdedd5  /bin/sh -c #(nop) ADD file:<hash> in /etc/chef/client.rb           132 B
8a3981e5fa44  /bin/sh -c #(nop) ADD file:<hash> in /etc/chef/client.pem          1.679 kB
a6e2feedecb1  mkdir -p /etc/chef+                                                0 B
2d24f826cb16  /bin/sh -c #(nop) CMD [/bin/bash]                                  0 B

Please note 911920e7729f and d18b21b38ae7. Ideally, I believe, it has to be merged into single layer (85d60acf156b). It is also important to allow completely remove chef-client from image to save ~200Mb.

So far the only workaround here is to reimport image with docker export <conainer_id> | sudo docker import - <my_compact_image_name>. Thoug, I personaly don't like this approach because it also wipes out underlying layers of base image (for instance, ubuntu image).

@marc- marc- changed the title Reduce image size produce by machine_mage resource Reduce image size produced by machine_mage resource Mar 5, 2015
@marc- marc- changed the title Reduce image size produced by machine_mage resource Reduce image size produced by machine_image resource Mar 5, 2015
marc- added a commit to marc-/chef-provisioning-docker that referenced this issue May 31, 2015
)

Signed-off-by: Maksim Chizhov <maksim.chizhov@gmail.com>
marc- added a commit to marc-/chef-provisioning-docker that referenced this issue May 31, 2015
)

Signed-off-by: Maksim Chizhov <maksim.chizhov@gmail.com>
@marc-
Copy link
Contributor Author

marc- commented May 31, 2015

With d06c253 base image size reduced from 411.3 MB to 243.7 MB.
There is still room for improvements, for instance, to install chef-client omnibus on host system instead of container. Though, I'm not sure if packages for different system has same system independent content.

marc- added a commit to marc-/chef-provisioning-docker that referenced this issue Jun 10, 2015
)

Signed-off-by: Maksim Chizhov <maksim.chizhov@gmail.com>
marc- added a commit to marc-/chef-provisioning-docker that referenced this issue Jun 23, 2015
)

Signed-off-by: Maksim Chizhov <maksim.chizhov@gmail.com>
marc- added a commit to marc-/chef-provisioning-docker that referenced this issue Jun 23, 2015
)

Signed-off-by: Maksim Chizhov <maksim.chizhov@gmail.com>
marc- added a commit to marc-/chef-provisioning-docker that referenced this issue Jun 23, 2015
)

Signed-off-by: Maksim Chizhov <maksim.chizhov@gmail.com>
marc- added a commit to marc-/chef-provisioning-docker that referenced this issue Aug 12, 2015
)

Signed-off-by: Maksim Chizhov <maksim.chizhov@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant