Files
docker-docs/content/manuals/offload/optimize.md
Craig Osterhout e9ad5f424e offload: enterprise ea (#23632)
<!--Delete sections as needed -->

## Description

Updated Offload Beta docs for enterprise EA.

Notable topics updated:

- [All topics under
`/offload/`](https://deploy-preview-23632--docsdocker.netlify.app/offload/)
- [Manage Docker
products](https://deploy-preview-23632--docsdocker.netlify.app/admin/organization/manage-products/)
- [Settings reference - Enable Docker
Offload](https://deploy-preview-23632--docsdocker.netlify.app/enterprise/security/hardened-desktop/settings-management/settings-reference/#enable-docker-offload)
- [Settings - Docker
Offload](https://deploy-preview-23632--docsdocker.netlify.app/desktop/settings-and-maintenance/settings/#docker-offload)
- [VM/VDI - Use Docker
Offload](https://deploy-preview-23632--docsdocker.netlify.app/desktop/setup/vm-vdi/#use-docker-offload)
- [Docker Offload CLI
reference](https://deploy-preview-23632--docsdocker.netlify.app/reference/cli/docker/offload/)

~~**Pending audit log updates**~~ Will handle in followup PR to keep
this moving

## Related issues or tickets

DCL-745
DCL-1033
DCL-1019
ENGDOCS-2929

## Reviews

<!-- Notes for reviewers here -->
<!-- List applicable reviews (optionally @tag reviewers) -->

- [ ] Technical review
- [ ] Editorial review
- [ ] Product review

---------

Signed-off-by: Craig Osterhout <craig.osterhout@docker.com>
2025-11-06 23:54:16 -08:00

79 lines
3.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: Optimize Docker Offload usage
linktitle: Optimize usage
weight: 40
description: Learn how to optimize your Docker Offload usage.
keywords: cloud, optimize, performance, offload
---
Docker Offload builds and runs your containers remotely, not on the machine where you invoke the
commands. This means that files must be transferred from your local system to the
cloud over the network.
Transferring files over the network introduces higher latency and lower
bandwidth compared to local transfers.
Even with optimizations, large projects or slower network connections can lead to longer transfer times. Here are
several ways to optimize your setup for Docker Offload:
- [Use `.dockerignore` files](#dockerignore-files)
- [Choose slim base images](#slim-base-images)
- [Use multi-stage builds](#multi-stage-builds)
- [Fetch remote files during the build](#fetch-remote-files-in-build)
- [Leverage multi-threaded tools](#multi-threaded-tools)
For general Dockerfile tips, see [Building best practices](/manuals/build/building/best-practices.md).
## dockerignore files
A [`.dockerignore` file](/manuals/build/concepts/context.md#dockerignore-files)
lets you specify which local files should *not* be included in the build
context. Files excluded by these patterns wont be uploaded to Docker Offload
during a build.
Typical items to ignore:
- `.git` avoids transferring your version history. (Note: you wont be able to run `git` commands in the build.)
- Build artifacts or locally generated binaries.
- Dependency folders such as `node_modules`, if those are restored in the build
process.
As a rule of thumb, your `.dockerignore` should be similar to your `.gitignore`.
## Slim base images
Smaller base images in your `FROM` instructions can reduce final image size and
improve build performance. The [`alpine`](https://hub.docker.com/_/alpine) image
is a good example of a minimal base.
For fully static binaries, you can use [`scratch`](https://hub.docker.com/_/scratch), which is an empty base image.
## Multi-stage builds
[Multi-stage builds](/build/building/multi-stage/) let you separate build-time
and runtime environments in your Dockerfile. This not only reduces the size of
the final image but also allows for parallel stage execution during the build.
Use `COPY --from` to copy files from earlier stages or external images. This
approach helps minimize unnecessary layers and reduce final image size.
## Fetch remote files in build
When possible, download large files from the internet during the build itself
instead of bundling them in your local context. This avoids network transfer
from your client to Docker Offload.
You can do this using:
- The Dockerfile [`ADD` instruction](/reference/dockerfile/#add)
- `RUN` commands like `wget`, `curl`, or `rsync`
### Multi-threaded tools
Some build tools, such as `make`, are single-threaded by default. If the tool
supports it, configure it to run in parallel. For example, use `make --jobs=4`
to run four jobs simultaneously.
Taking advantage of available CPU resources in the cloud can significantly
improve build time.