Skip to content

Reduce layers / use Docker CLI to reduce img size #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tekgator
Copy link
Contributor

Hi Jarno,

I reduzed the image size by more than 50% (411MB vs 857MB) by reducing layers and installing only the Docker CLI.

size

First step was reducing the amount of layers, this reduced the image to around 600MB. Second step was removing the complete docker installation, so the image size shrinks to around 450 MB.

After adding an apt-clean and removing tmp files the image is finally reduced to 411 MB:

image

@tekgator
Copy link
Contributor Author

I believe the image size can be reduced even more by consolidating the other layers into one layer, but then the code is most likly not so readable anymore and it only saves you a few MB.

@tekgator
Copy link
Contributor Author

Another possibility would be to remove the Docker CLI completly.
You can actually just mount /usr/bin/docker into the container to achive the same result.

This would bring the image size down to 237MB

image

@varhub
Copy link
Contributor

varhub commented Mar 26, 2021

+1 to PR
Correct way to srink image following best practices.
But im at mobile and cannot check deb amd64.

About remove docker cli..., should or could container be able to manage remote instances? In that case cli is mandatory

@tekgator
Copy link
Contributor Author

@varhub I believe remote access is not required as the backup volumes need to be local as well. At least I cannot think of another possibility right now.

@varhub
Copy link
Contributor

varhub commented Mar 27, 2021

Hello @tekgator , Im only trying to be wide (even it makes no sense).
I dont know if this scenario is viable:
Use a second pc as backup host of other machines. It will mount volumes via nfs and support multiple docker instances by mounting/accessing appropriate docker port/socket.

On the other hand, halving again container size is great.

Even if this could be viable, without locallan or vpn or ipv6 will not be feasible. What do you think?

@tekgator
Copy link
Contributor Author

@varhub You're correct, but still I see another problem. Even though lets says remote backup (nfs) is a topic the image by itself does not support remote docker control yet. Here we would need the ability to pass IP and port to the container. Most likly remote control is also secured by username/pass or even via SSL certificate. In this case it needs to be passed to the container as well somehow.

Until this is implemented I think it would be save to remove the Docker CLI from the image and just mount it from the host system via /usr/bin/docker. Then there is also no worries about arm / amd64 etc.

@varhub
Copy link
Contributor

varhub commented Mar 27, 2021

Indeed. Thanks @tekgator for dive me in.

@jan-brinkmann jan-brinkmann mentioned this pull request Jan 3, 2022
@varhub
Copy link
Contributor

varhub commented Feb 13, 2022

Sorry @tekgator.

I forgot about this PR and just create 2 more that overlaps it (#53 , #54).

@jareware
Copy link
Owner

jareware commented Mar 2, 2022

@tekgator the 2 PR's referenced above have been merged.

Is there something here that's not covered there?

@tekgator
Copy link
Contributor Author

tekgator commented Mar 2, 2022

@jareware: I guess it is fine, even though my PR utilized the package manager instead of the docker install script. Not sure if this is any better. As mentioned I think the Docker CLI could be removed as well as there is no need for it. This would bring down image even further.

From my point of view it can be closed, just don't understand how this overlap happened in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants