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
Very slow image import/export during WITH DOCKER #1268
Comments
Hi @konradmalik - this is a known issue. However, I don't think it had been previously documented - so thanks for opening this. WorkaroundsNone that I know of. But you could try using Future improvementsThere are a few ways to improve the performance of this in the future. It's a bit complex, hence that's why it hasn't been done just yet. 1. Optimizing the images transferThe most bang for the buck is probably achieved by optimizing the transfer of images from Buildkit to the inner Docker daemon. Currently, this relies on passing image 2. Parallelizing the client-side moreThere are cases where a The original issue is described here: #888. This has been addressed for parallel In any case, even without the above, enabling the feature provided by #888 could still be beneficial. I just wrote instructions here how: #888 (comment). 3. Future locally workaroundIt's possible to improve the This has the disadvantages of In any case, this is probably a bit easier to implement (but it's still pretty gnarly if first-time contributing given that it's so cross-cutting). This can reuse the work done in #500. The export of individual images is done here: https://github.com/earthly/earthly/blob/main/earthfile2llb/withdockerrunlocal.go#L100. It uses a |
Another thought for optimizing the image transfer: Besides using a local registry for passing in the images to the inner Docker, we could additionally use the stargz snapshotter in the inner Docker, to lazily download bits and pieces from the loaded images as they are actually needed. Because the download operation is local, the lazy download should be almost unnoticeable. This should reduce the delay caused by loads+transfer of bytes to near zero. One wrinkle though... I'm not sure how re-tagging might work (when downloading from the local registry, the image will have a local address pre-pended to the image tag, which requires re-tagging to get it to the right image name as required by the user). |
The latest release of Earthly improves the performance a bit as it takes care of most of item 2 in the comment above. This is behind a feature flag as it's experimental, however: |
Item 1 is being GA'd in the next release. Item 2 has been GA'd for some time already. |
…prominent (#2266) Closes #1268 Note that the feature flag `--use-registry-with-docker` is backward compatible, hence we can enable it retroactively for all versions, now that we have confidence in the way it functions. For earthly-in-earthly used in our integration tests, `WITH DOCKER` doesn't work correctly with the embedded registry, due to the use of `NETWORK_MODE=host`. In such cases, we force the old behavior via the override feature flags functionality. Co-authored-by: Vlad A. Ionescu <vladaionescu@users.noreply.github.com>
Hey,
Recently I started to use Earthly for some of my projects.
So far, the majority of stuff works great, but the biggest drawback seems to be performance.
Everything runs a little bit slower, which is expected and completely fine. However, the worst impact that we see is for
docker-compose
based integration tests.Specifically, in the example below:
I have one image that is built via earthly and three others that need to be pulled and used in the docker-compose file I provided (dependencies for the integration test).
The problem is, that the import/export of all those images takes much longer (2, 3 times. Depending on the machine it may be 5-10 mins) than the running of the tests itself.
"Standard" approach with plain docker-compose is much, much faster.
This is the command I run for the reference:
Problems I noticed:
Any ideas on how to debug, optimize or improve this?
I'll take all:
The text was updated successfully, but these errors were encountered: