Install only docker-cli for 30% smaller kamal docker image#1541
Merged
djmb merged 1 commit intobasecamp:mainfrom Jun 12, 2025
Merged
Install only docker-cli for 30% smaller kamal docker image#1541djmb merged 1 commit intobasecamp:mainfrom
djmb merged 1 commit intobasecamp:mainfrom
Conversation
As only the docker client is executed in the image and not the docker daemon, only the docker-cli package is needed
Contributor
Author
|
I tested the changes already locally and the resulting image still works the same. Could a maintainer approve the workflow to see if the CI still passes too? |
Collaborator
|
Thanks @polarctos! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As only the docker client is executed in the image and not the docker server/daemon, only the
docker-clipackage is needed to be installed.The docs already include the mount of the docker daemon socket from the host:
-v /var/run/docker.sock:/var/run/docker.sockhttps://kamal-deploy.org/docs/installation/dockerized/
This reduced the image size from 733 MB to 511 MB for a local build for me, thus ca. 30% less.
Which makes the initial pull faster both on developer machines and in CI pipelines.
The image size could probably be reduced even further with Docker multi-stage builds.
Have you thought about packaging a fully native executable of releases? e.g. with Tebako or TruffleRuby
I think for non-Ruby developers this could reduce the barrier of using Kamal, as the suggested docker approach surely also works, but might look a bit cumbersome. Such a native binary could then probably also more easily be packaged for package managers like
brew.